Write a program to create a customer bill for a shop The pro
Solution
#include <iostream>
using namespace std;
//Separate function to calculate each item cost for watch
int watch()
{
return 90;
}
//Separate function to calculate each item cost for shoe
int shoe()
{
return 20;
}
//Separate function to calculate each item cost for shirt
int shirt()
{
return 15;
}
int main()
{
long int Watch,Shoe,Shirt; //variables for QTY for watch,shoe and shirt
long int tot_cost_watch,tot_cost_shoe,tot_cost_shirt; //variables for total Cost of each item
cout<<\"Enter the number of watches purchased: \";
cin>>Watch;
cout<<\"Enter the number of shoes purchased: \";
cin>>Shoe;
cout<<\"Enter the number of shirts purchased: \";
cin>>Shirt;
cout<<endl<<endl;
/*
Total Cost (Cost (KD) column) will be
Total Cost = QTY * (Unit Price)
*/
tot_cost_watch = Watch * watch();
tot_cost_shoe = Shoe * shoe();
tot_cost_shirt = Shirt * shirt();
cout<<\"Item \\t QTY \\t Unit Price(KD) \\t Cost(KD) \"<<endl;
cout<<\"---- \\t --- \\t -------------- \\t -------- \"<<endl;
cout<<\"Watch \\t\"<<Watch<<\" \\t\"<<watch()<<\"\\t\\t\\t\"<<tot_cost_watch<<endl;
cout<<\"Shoe \\t\"<<Shoe<<\" \\t\"<<shoe()<<\" \\t\\t\\t\"<<tot_cost_shoe<<endl;
cout<<\"Shirt \\t\"<<Shirt<<\" \\t\"<<shirt()<<\"\\t\\t\\t\"<<tot_cost_shirt<<endl;
cout<<endl;
/*
Total Price will be
Total Price = Total Cost of Watch + Total Cost of Shoes + Total Cost of Shirt
*/
cout<<\"Total Price : \"<<tot_cost_watch+tot_cost_shoe+tot_cost_shirt<<\" KD\"<<endl;
return 0;
}

