Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have this, along with my retail outline. You have been asked to write a progra

ID: 669066 • Letter: I

Question

I have this, along with my retail outline.

You have been asked to write a program to calculate sales totals for a general store. Your program will not know how many products each customer will buy, so your program will have to repeat the process until the last product has been entered (use -1 for Product ID to end each sale).  After each sale your program must ask if you want to do another sale (1 –continue, 0 – end program).

At the beginning of the day, the cash drawer has $500 in it. At the end of the program you must display how much money is in the drawer after handling all your sales transactions.

Input

Your program must take the following input:

• Product ID Number (int)

• Quantity for each item purchased (int)

Use the following dataset to determine the price and taxability for each item.  

First Sale:

Product ID

Price

Quantity

Taxable

101

$65.00

2

Yes

102

$12.50

1

No

103

$24.50

5

No

104

$38.75

4

Yes

105

$17.80

6

Yes

106

$16.50

2

No

107

$42.85

8

Yes

108

$32.99

2

Yes

109

$28.75

1

Yes

110

$51.55

1

No

Second Sale:

Product ID

Price

Quantity

Taxable

102

$12.50

1

No

103

$24.50

1

No

106

$16.50

1

No

107

$42.85

1

Yes

108

$32.99

1

Yes

109

$28.75

1

Yes

Third Sale:

Product ID

Price

Quantity

Taxable

106

$16.50

4

No

107

$42.85

3

Yes

108

$32.99

1

Yes

109

$28.75

5

Yes

110

$51.55

2

No

Calculating Tax

For those items that are taxable, assume a 7.5% sales tax. Be sure to keep a running total of tax for the each sale.

Getting Started

#include
#include
using namespace std;
int main() {
  
double cashDrawer = 500.00
int productID = 0;
int quantity =0;
double price = 0.0;
double salesTax = 0.0;
double totalSale = 0.0;
int anotherSale = 1;
double subtotal = 0.0;
double taxRate = 0.0;
  
do(
  
  
while (productID != -1)
{
  
cout << "Enter the quantity of this item: "
  
switch(productID)
{
case 101:
price = 65.0;
taxRate 0.075;
break;
case 102:
price = 12.5;
taxRate = 0.0;
break;
  
  
//calculation
subtotal += price * quantity * (1 + taxRate);
salesTax+= quantity * price * taxRate;
  
cout << "Enter the next Product ID(-1 to quit): ";
cin >> productID;
  
}
  
totalSale = subTotal + salesTax;
cashDrawer += totalSale;
  
cout << "Subtotal: $" << setw(11) << fixed << setprecision(2) << subtotal << endl
<<" Tax: $" << setw(11) << fixed << setprecision(2) << salesTax << endl
<<" Total: $" << setw(11) << fixed << setprecision(2) << totalSale <   
  
subtotal = 0
}

New edited code, need to change some things because it won't run:

#include <iostream>
using namespace std;
int main()
{
double cashDrawer = 500.00;
int productID = 0;
int quantity = 0;
double price = 0.0;
double subtotal = 0.0;
double salesTax = 0.0;
double totalSale = 0.0;
int anotherSale = 1;
int i = 1;
// Loop for repeat sales.Assume we have atleast one sale.
while(anotherSale != 0)
{
// Enter the first Product ID for the first sale (-1 to exit)
subtotal = 0.0;
salesTax = 0.0;
cout<<"Enter the first Product ID: ";
cin>>productID;
// Main loop for each sale
while(productID != -1)
{
cout<<"Enter the quantity sold of type productID "<<productID<<": ";
cin>>quantity;
// Switch statement to determine the price, and calculate sales tax, if any, for the item.
switch(productID)
{
case 101:
       price = 65.00;
       salesTax += price * 0.075 * quantity;
       break;
case 102:
       price = 12.50;
       break;
case 103:
       price = 24.50;
       break;
case 104:
       price = 38.75;
       salesTax += price * 0.075 * quantity;
       break;
case 105:
       price = 17.80;
       salesTax += price * 0.075 * quantity;
       break;
case 106:
       price = 16.50;
       break;
case 107:
       price = 42.85;
       salesTax += price * 0.075 * quantity;
       break;
case 108:
       price = 32.99;
       salesTax += price * 0.075 * quantity;
       break;
case 109:
       price = 28.75;
       salesTax += price * 0.075 * quantity;
       break;
case 110:
       price = 51.55;
       salesTax += price * 0.075 * quantity;
       break;
default:
       cout<<"Invalid ProductID."<<endl;
}
subtotal += salesTax + price * quantity;
// Get next Product ID
cout<<"Enter the next Product ID: ";
cin>>productID;
}
// Print properly formatted output for each sale
cout<<"The total of this sale is: "<<subtotal<<"."<<endl;
totalSale += subtotal;
// Another sale?
cout<<"Do you have another sale(1. Continue, 0. End): ";
cin>>anotherSale;
}
cashDrawer += totalSale;
// Display how much is in the cash drawer at the end
cout<<"The balance in the cash drawer is: "<<cashDrawer<<"."<<endl;
}

Product ID

Price

Quantity

Taxable

101

$65.00

2

Yes

102

$12.50

1

No

103

$24.50

5

No

104

$38.75

4

Yes

105

$17.80

6

Yes

106

$16.50

2

No

107

$42.85

8

Yes

108

$32.99

2

Yes

109

$28.75

1

Yes

110

$51.55

1

No

Explanation / Answer

//Executed successfully in VS2010. You may modify this now as per your needs.

#include <stdio.h>
#include <conio.h>
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
   int salesno;
   double cashDrawer = 500.00;
int productID = 0;
int quantity =0;
double price = 0.0;
double salesTax = 0.0;
double totalSale = 0.0;
double subtotal = 0.0;

   for (salesno=1;salesno<=3;salesno++){
       cout<<" SALE "<<salesno;
      
       while(productID != -1){
           cout<<" Enter the productid (Enter -1 to end current sale) ";
           cin>>productID;
           if(productID!= -1){
           cout<<" Enter quantity of item purchased ";
           cin>>quantity;
           }
           switch(productID){
           case 101:
               subtotal=((quantity*65)+(quantity*65*0.075))+subtotal;
               break;
           case 102:
               subtotal=((quantity*12.5)+(quantity*65*0))+subtotal;
               break;
           case 103:
               subtotal=((quantity*24.5)+(quantity*65*0))+subtotal;
               break;
           case 104:
               subtotal=((quantity*38.75)+(quantity*65*0.075))+subtotal;
               break;

           case 105:
               subtotal=((quantity*17.80)+(quantity*65*0.075))+subtotal;
               break;

           case 106:
               subtotal=((quantity*16.50)+(quantity*65*0))+subtotal;
               break;

           case 107:
               subtotal=((quantity*42.85)+(quantity*65*0.075))+subtotal;
               break;

           case 108:
               subtotal=((quantity*32.99)+(quantity*65*0.075))+subtotal;
               break;

           case 109:
               subtotal=((quantity*28.75)+(quantity*65*0.075))+subtotal;
               break;

           case 110:
               subtotal=((quantity*51.55)+(quantity*65*0))+subtotal;
               break;
           }
       cout<< " Total Sale for "<< salesno << " is "<<subtotal;
       }
       totalSale=totalSale+subtotal;
       productID=0;
   }
   cout<< " Total Sale for entire sale is "<<totalSale+cashDrawer;
getch();
return 0;
}