Question
Asked by:
scf500
scf500
Rating : No Rating
Questions Asked: 2
Tutorials Posted: 0
 

$20.00 C++ Switch Statement

Q:
A mail order house sells five different products whose retail prices are: product 1 - $2.98, product 2- $4.50, product 3-$9.98, product 4-$4.49 and product 5-$6.87. Write a program that reads a series of pairs of numbers as follows:

1. product number
2. quantity sold

The program should include a statement to determine the retail price for each product. The program should calculate and display the total retail value of all products sold. Use a sentinel-controlled poop to determine when the program should stop looping and display the final results.
 


   
   
   
   
 
Available Tutorials to this Question
Posted by:
chetan2009
chetan2009
Rating (146): A
Questions Asked: 0
Tutorials Posted: 464, earned $2,832.42
 

$10.00 Compiled and Tested solution

  • This tutorial hasn't been purchased yet.
  • Posted on Nov. 02, 2008 at 09:08:07AM
A:
Preview: ... e sum=0;<br>while(1) {<br>cout<<"\\\\nEnter product number (-1 to end):";<br>cin>>product;<br>if(product!=-1) {<br>cout<<"\\\\nEnter quantity sold:";<br>cin>>quantity;<br>}<br>else {<br>break;<br>} ...

The full tutorial is about 86 words long plus attachments.

Attachments:
sale.cpp (1K)
Posted by:
rainman
rainman
Rating (40): A+
Questions Asked: 2
Tutorials Posted: 174, earned $906.64
 

$2.50 Compiled and Tested Solution. Loop and switch as asked!

  • This tutorial was purchased 2 times and rated C- by students like you.
  • Posted on Nov. 02, 2008 at 10:04:54AM
A:
Preview: ... ch(productNumber)<br> {<br> case 1:<br> total += quantity * 2.98;<br> break;<br><br> case 2:<br> total += quantity * 4.50;<br> break;<br><br> case 3:<br> to ...

The full tutorial is about 537 words long plus attachments.

Attachments:
main.cpp (1K)
   
Join Now or Log In
Get Tutoring
Get Paid
Academic Honesty