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
  • JavaFX code for a simple tableview done in scene builder which only shows first name and...

    JavaFX code for a simple tableview done in scene builder which only shows first name and last name populated automatically from the netbeans derby database? Im having trouble making it do it so anything would help. Thank you

  • C++ Simple code please Thank you in advance B. Write a C++ program as per the...

    C++ Simple code please Thank you in advance B. Write a C++ program as per the following specifications: a. Define the class BankAccount to store a bank customer's account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide the following operations: set the account number, retrieve the account number, retrieve the balance, deposit and withdraw money, and print account information. Add appropriate constructors. b. Every bank...

  • in python would you please help me to keep this code as in a simple and...

    in python would you please help me to keep this code as in a simple and easy code to follow please I want the code to run like first line of the letters ['B', 'C', 'D', 'BC', 'CB', 'BD', 'BCB', 'CBD', 'BCBD'] ['B', 'BC', 'BCB', 'BCBD', 'C', 'CB', 'CBD', 'BD', 'D'] word="BCBD" lst=[] for i in range(len(word)): for j in range(i+1,len(word)+1): if word [i:j] not in lst: lst.append(word[i:j]) print(lst)

  • Please help! Studying for my c++ test! What does the following code produce? include <iostream>   ...

    Please help! Studying for my c++ test! What does the following code produce? include <iostream>    using namespace std; void my_function(int n); void main() {     my_function(546); } void my_function(int n) {     if (n < 10)         cout << n << endl;     else     {         my_function(n/10);         cout << (n%10) << endl;     } } What is the output of the following code?                   int j=32, k=5, r;                   r = j ^ k;                   cout << r...

  • Ordering Delivery and receipt of merchandise Shelf-stocking Customer support and assistance $104 per purchase order $82...

    Ordering Delivery and receipt of merchandise Shelf-stocking Customer support and assistance $104 per purchase order $82 per delivery $18 per hour $0.24 per item sold Milk and Baked Goods Fruit Juice Frozen Products Financial data je ne Revenues $ 57,500 $ 66,500 $ 50,500 Cost of goods sold 39,000 $ 46,000 $ 33,000 Store suppbrt $ 11,700 $ 13,800 $ 9,900 Activity-area usage (cost-allocation base) Ordering (purchase orders) 20 15 5 Delivery (deliveries) 100 40 35 Shelf-stocking (hours) 195 170...

  • PLEASE HELP 5. Explain the outcomes of a goods receipt step of the procurement process. 6....

    PLEASE HELP 5. Explain the outcomes of a goods receipt step of the procurement process. 6. Explain the outcomes of the invoice verification step of the procurement process. 7. What is a distribution chain? How is it relevant to the fulfillment process?

  • can someone help write a simple c++ code that inputs a file and decrypts it using...

    can someone help write a simple c++ code that inputs a file and decrypts it using ascii code -4.

  • PLEASE DESCRIBE THE STEPS IN THE CODE! please.. (simple code) In this homework, the rail fence...

    PLEASE DESCRIBE THE STEPS IN THE CODE! please.. (simple code) In this homework, the rail fence cipher is written in Python. We did implement this already in the class by appending letters sequentially to three different lists, which represented three rails. In this project, you are allowed to implement it in any other way. First step is to drop all the space characters inside the plain text. An easy way to implement it is to notice that the first rail...

  • Code "string removeDuplicates(string original)" in C++. Please do as simple as possible!

    Code "string removeDuplicates(string original)" in C++. Please do as simple as possible!

  • Suppose that, assuming a firm decides to produce a product, it must build a production facility....

    Suppose that, assuming a firm decides to produce a product, it must build a production facility. The fixed cost of this facility is F = 90. Also, the firm has constant marginal cost, MC = 5. Demand for the product that the firm produces is given by P = 40-5Q. a) On a single graph, carefully draw the MC curve, the demand curve, and the ATC curve. Your graph should go up to 8 units of output. Please label your...

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