Write a C++ program that will find out the total amount of a customer's bill according to the items he or she has purchased.
Create two classes:
Purchased_item,
Bill
The Purchased_item should be having the following data members
item_num //for item number
note: item_num //should be static. This data member will be used to display the item number whose information is currently required 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 to calculate the total amount and assign it to the data member , total_amount
Your program should take input of the price and quantity of 5 items and display the total amount after calculation.
OUTPUT
Your output should be similar to the following
enter price and purchased quantity of item 1
price:20
Quantity:5
enter price and purchased quantity of item 2
price:10
Quantity:2
enter price and purchased quantity of item 3
price:15
Quantity:1
enter price and purchased quantity of item 4
price:30
Quantity:2
enter price and purchased quantity of item 5
price:10
Quantity:2
Total amount to be paid is 215
Awesome. Now what is the question?
And we still won't do your schoolwork for you. Post whatever code you have so far and many people here will be glad to help you out.
OK. only tell me How to calculate the total amount I am confused.
Thankyou.
In simple pseudocode:
First, initialize TOTAL to 0.
Then, loop for 5 iterations:
Input PRICE
Input QUANTITY
TOTAL = TOTAL + (PRICE * QUANTITY)
Finally, print TOTAL
Thank you so much!!!!!!!!!!!!!!!!!!!!!!!!
Its very helpful.