# Q:-1             Draw and discuss programmer’s vie...

Q:-1             Draw and discuss programmer’s view of Falcon EAssembler
Q:-2

Write a C++ program that will find out thetotal amount of a customer's bill according to the itemspurchased.

Create two classes: Purchased_item,Bill

The Purchased_item should be having the following datamembers

" item_num //foritem number

note: item_num //should be static. This data member will beused to display the item number whose information is currentlyrequired from the user

" price //for per unit price

" quantity //for quantity purchased

class Bill should have two data members

" total_amount //for the total amount of bill that is to be paid

" items[5] //an array of purchased_item; should be 5 in size

class Bill should also have a member function that is used tocalculate the total amount and assign it to the data member ,total_amount

Your program should take input of the price and quantity of 5items and display the total amount after calculation.

OUTPUT

Your output should be similar to the following

enter price and purchased quantity ofitem 1

price:20

Quantity:5

enter price and purchased quantity ofitem 2

price:10

Quantity:2

enter price and purchased quantity ofitem 3

price:15

Quantity:1

enter price and purchased quantity ofitem 4

price:30

Quantity:2

enter price and purchased quantity ofitem 5

price:10

Quantity:2

Total amount to be paid is 215

1. x.x?=sp;

#include <iostream.h>

#include <stdlib.h>

class Purchased_item

{

private:

static int item_num;         //for item number

int price;                   //for per unit price

int quantity;                //for quantity purchased

public:

// constructor of class

Purchased_item()

{

cout<<"Constructor of class purchased item is callled."<<endl;

this -> price = 0;

this -> quantity = 0;

}

//function to get the price of item

int getprice()

{

cout<<"price: ";

cin>>this -> price;

return price;

}

//function to get the quantity of item

int getquantity()

{

cout<<"quantity: ";

cin >>this -> quantity;

return quantity;

}

//function to get the items

static int items()

{

item_num++;

return item_num;

}

// destructor of class

~Purchased_item()

{

cout<<"Destructor of class purchased item is callled."<<endl;

}

};

int Purchased_item::item_num = 0;        // initializing static variable item_num

class Bill

{

private:

int total_amount;               //for the total amount of bill that is to be paid

Purchased_item items[5];        //an array of purchased_item; should be 5 in size

public:

// constructor of class

Bill()

{

cout<<"\nConstructor of class bill is called"<<endl;

this -> total_amount = 0;

}

//fucntion to caluculate total amount to be paid

void calculate()

{

for(int i=0; i<5; i++)

{

cout<<"\nenter price and purchased quantity of item "<< items[i].items() <<endl;

total_amount += items[i].getprice() * items[i].getquantity();

}

}

//funcion to display total amount to be paid

void display()

{

cout<<"\nTotal amount to be paid is : "<<total_amount<<endl;

}

// destructor of class

~Bill()

{

cout<<"\nDestructor of class bill is called"<<endl<<endl;

}

};

main()

{

Bill b;

b.calculate();

b.display();

return 0;

}

t?..W?0.0.