Question

Please help to build simple c++ code.

5. Produce receipt for the customer which shows the product they chose, the cost and balance of their money.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

//C++ code to allow user to choose product and view receipt of their balance after choosing a product

#include<iostream>
using namespace std;
int main()
{
float amount,cost,balance;
int option;
cout<<"Enter amount in wallet:"<<endl;
cin>>amount;
cout<<"choose product"<<endl;
cout<<"1. Phone\n2.Laptop\n3.Television";
cin>>option;
switch(option)
{
case 1:cout<<"Product:Phone"<<endl;
cout<<"cost = "<<5000<<"$"<<endl;
balance=amount-5000;
cout<<"Balance = "<<balance<<"$"<<endl;
break;

case 2:cout<<"Product:Laptop"<<endl;
cout<<"cost = "<<8000<<"$"<<endl;
balance=amount-8000;
cout<<"Balance = "<<balance<<"$"<<endl;
break;

case 3:cout<<"Product:Television"<<endl;
cout<<"cost = "<<4000<<"$"<<endl;
balance=amount-5000;
cout<<"Balance = "<<balance<<"$"<<endl;
break;

default: cout<<"invalid product "<<endl;
}
return 0;
}

Run Debug Stop e Shar main.cpp C option; switch(option) 13 14 case 1:cout< < Product:PH Enter amount in wallet: 12000 choose

For any clarification please post in comment section.

Add a comment
Know the answer?
Add Answer to:
Please help to build simple c++ code. 5. Produce receipt for the customer which shows the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT