Question
Here's the prompt: Write a program for a store. Your program shall print the greetings like Welcome to ABC store. Your program shall let the
Here's the prompt:
Write a program for a store. Your program shall print the greetings like "Welcome to ABC store". Your program shall let the cashier input the item and it's dollar price.
Your program shall allow cashier to input -1 to terminate the input anytime.
Your program should print a report with following elements:
- Price of each item purchased
- Total number of items purchased
- Grand total of all the purchases
- Most expensive purchase
- Least expensive purchase
- Average cost of items purchased
Prompts
***** Welcome to ABC store *****
"Do you have any item to scan?Enter (Y) to scan and (N) to generate the final invoice: "Y
"Enter any number to beginscanningyour items.Enter -1 to generate final invoice."1
"Please enter the price for Item:" 11
***** Welcome to ABC store *****
********* Here are details of this purchase *********
Item number : 1 ***** $11
Item number : 2 ***** $22
Item number : 3 ***** $5
Item number : 4 ***** $6
Your bag contains total of 4items.
Grand Total for this purchase is: $44
Theleast expensive item in your bag is :$ 5
Themost expensive item in your bag is : $22
Your average item cost for this purchase is : $11
This is the code I have already with a classmates recommendations (I know I still have some things to get done though) :
#include
#include
using namespace std;
int main()
{
string answer;
int choice = 0, sum = 0;
int max = 0, min = 0;
int count = 1;
int avg = 0;
float cost;
int array[10];
cout << endl;
cout << "********** Welcome to My Store **********" << endl;
cout << endl;
cout << "Do you have any items to scan? Enter (Y) to scan and (N) to generate the final invoice: ";
cin >> answer;
if (answer == "y" || answer == "Y")
{
cout << "Enter any number to begin scanning your items. Enter -1 to generate final invoice. ";
cin >> choice;
cout << endl;
while (choice != -1)
{
for (count = 1; count == 10; count++)
{
cout << "Enter the cost of an item: ";
cin >> cost;
sum += cost;
cost++;
array[count] = cost;
}
if (cost>max)
max = cost;
if (cost min = cost; { array[count] = cost; cout << "***** Here are the details of your purchase *****" << endl; cout << "Item number : " << count << cost << endl; cout << "Your bag contains a total of: " << count << " items" << endl; cout << "Grand Total for this purchase is : $" << sum << endl; cout << "The least expensive item in your bag is: " << min << endl; cout << "The most expensive item in your bag is:" << max << endl; cout << "Your average item cost for this purchase is : " << avg << endl; break; } } } system("pause"); return 0; } What do I need to do from here? Feel free to provide any sort of instructions, write the code and some instructions, or just complete the code and I could figure it out myself? I'm also using this to study for a Final
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started