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

For this assignment, write a program that will process sales information for a c

ID: 3542733 • Letter: F

Question

For this assignment, write a program that will process sales information for a company. The company sells many products, but they are categorized into 3 product types: gizmos, doohickeys, and thingamajigs.

A product number will be used to signify the product type as follows:

The lower and upper bounds for the various ranges of product numbers should be made into symbolic constants and those names should be used in the executable code.

The user should initially be prompted for the product number of the item that was purchased. As long as a product number of -1 has not been entered, the user should then be prompted for 2 more pieces of information: the number of items that were purchased, and the price for one of those items.

The product number should be used to determine which type of product was purchased. For each of the product types, keep track of the total number of items sold and the total cost of all sales of that product. If the product number is invalid, then a counter of the number of invalid sales should be incremented.

After the sale has been processed, the user should be prompted for the product number of the next purchase. And as mentioned above, this processing should continue until the user enters a product number of -1 to indicate that there is no more sales information to be entered.

After the user enters the product number of -1, display the total number of items sold and total cost for each of the products and the total number of invalid sales.

Your program must be fully documented. Line documentation should be used wherever needed, but need not be on every line of code. White space and indentation should be used to make your code easily readable.

The values that are used in the Sample Output displayed below can be found here. However, it would be a good idea to test your program with a smaller subset of values.

Explanation / Answer

#define LOW_GIZMO 0
#define HIGH_GIZMO 999
#define LOW_DOOHICK 1000
#define HIGH_DOOHICK 2999
#define LOW_THING 3000
#define HIGH_THING 5999
#include<iostream>
using namespace std;
int main()
{
int item=0;
int no_of_items;
double price;
double sales_amount;
int gizmo_count=0,doohick_count=0,thing_count=0;
double gizmo_amount=0,doohick_amount=0,thing_amount=0;
int invalid_sales=0;
while(item!=-1)
{
cout <<"Enter the product number of the item sold: ";
cin >> item;
cout << endl;
if(item==-1) break;
cout << "Enter the number of items sold::";
cin >> no_of_items;
cout << endl;
cout << "Enter the price for one of the items:";
cin >> price;
cout << endl;
cout << endl;
sales_amount = price*no_of_items;
if(item>= LOW_GIZMO && item<= HIGH_GIZMO)
{
gizmo_count = gizmo_count + no_of_items;
gizmo_amount = gizmo_amount + sales_amount;
}
else if(item>= LOW_DOOHICK && item<= HIGH_DOOHICK)
{
doohick_count = doohick_count + no_of_items;
doohick_amount = doohick_amount + sales_amount;
}
else if(item>= LOW_THING && item<= HIGH_THING)
{
thing_count = thing_count + no_of_items;
thing_amount = thing_amount + sales_amount;
}
else
{
invalid_sales++;
}
}
cout <<endl<<"***** Product Sales Summary ***** " << endl;
cout << endl;
cout <<"Gizmo Count: " << gizmo_count << endl;
cout <<"Gizmo Sales Total: " << gizmo_amount << endl;
cout << endl;
cout <<"Doohickey Count: "<<doohick_count << endl;
cout <<"Doohickey Sales Total: "<<doohick_amount << endl;
cout << endl;
cout <<"Thingamajig Count: " << thing_count << endl;
cout <<"Thingamajig Sales Total: "<<thing_amount << endl;
cout << endl;
cout << "Invalid Sales: "<< invalid_sales << endl;
//system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote