Question

In: Computer Science

A customer in a grocery store is purchasing three items. Write the pseudo code that will:...

A customer in a grocery store is purchasing three items. Write the pseudo code that will:

• Ask the user to enter the name of the first item purchased. Then ask the user to enter the cost of the first item purchased. Make your program user friendly. If the user says the first item purchased is milk, then ask: “What is the cost of milk.” [This should work no matter what item is entered by the user. I might buy candy rather than milk.]

• Ask the user to enter the name and cost of the second item purchased.

• Ask the user to enter the name and cost of the third item purchased.

• Calculate the amount of sales tax due on the total purchase price. The sales tax rate is 5%.

• Tell the user • The name and price of each item entered

• The total cost of the items purchased • The amount of sales tax due on the total purchase.

• The total amount due from the user [total cost plus sales tax] • Hint: Your first line of code should be: constant real SALES_TAX_RATE = .05;

Structure your code as follows: 1. Declare variables 2. Get user input 3. Do calculations. 4. Output what is required

Idk if its c or c++ but this is an example I have, need it to be written like that

// declare variables
Real totalSales;
Real profits;

// get user input
print "Enter amount of total sales";
totalSales = User Input;

// do calculations
profit = totalSales * .10;

// output
print "Your profit is", profit;

Solutions

Expert Solution

#include<iostream>
using namespace std;
int main()
{
   const double SALES_TAX_RATE =.05;
   string item1,item2,item3;
   double cost1,cost2,cost3;
   //reading input
   cout<<"Enter name of item:";
   cin>>item1;
   cout<<"Enter cost of "<<item1<<":";
   cin>>cost1;
   cout<<"Enter name of item:";
   cin>>item2;
   cout<<"Enter cost of "<<item2<<":";
   cin>>cost2;
  
   cout<<"Enter name of item:";
   cin>>item3;
   cout<<"Enter cost of "<<item3<<":";
   cin>>cost3;
  
   //computing displaying output
   cout<<item1<<" cost :"<<cost1<<endl;
   cout<<item2<<" cost :"<<cost2<<endl;
   cout<<item3<<" cost :"<<cost3<<endl;
  
   double TotalSales = cost1+cost2+cost3;
   cout<<"Total cost of items purchased :"<<TotalSales<<endl;
   double SalesTax = TotalSales*SALES_TAX_RATE;
   cout<<"The amount of sales tax due on the total purchase :"<<SalesTax<<endl;
   cout<<"The total amount due from the user :"<<TotalSales+SalesTax<<endl;
  
   return 0;
}

output:

Enter name of item:milk
Enter cost of milk:100
Enter name of item:cofee
Enter cost of cofee:120
Enter name of item:pepsi
Enter cost of pepsi:20
milk cost :100
cofee cost :120
pepsi cost :20
Total cost of items purchased :240
The amount of sales tax due on the total purchase :12
The total amount due from the user :252


Process exited normally.
Press any key to continue . . .



Related Solutions

Calculate your Customer Lifetime Value (CLTV) as a grocery customer. How should a grocery store segment...
Calculate your Customer Lifetime Value (CLTV) as a grocery customer. How should a grocery store segment its market? Why? Create personas for each market segment the store should have.
produce the pseudo code for the Barber routine Clipaway() and the Customer routine Cutmyhair() such that...
produce the pseudo code for the Barber routine Clipaway() and the Customer routine Cutmyhair() such that each customer is given a customized haircut and each customer pays for the Barber’s service. The Sleeping Barber Problem This works for a shop that holds a total of N customers with one barber. If a customer cannot enter the shop, the customer will be forced into the street. Start the Barber before the customers. Shared variables: const int num_chairs = N; // number...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese $3.29 Butter $4.99 Eggs $3.49 Yogurt $3.49 Juice $3.89 Tea $3.69 Chips $3.99 Soda $1.99 Pastry $2.99 Cerrial $4.99 Oats $3.29 Almond Milk $2.79 Almonds $4.39 Popcorn $3.29 Crackers $3.59 Ice Cream $6.99 Cookies $2.99 Jam $3.69 Peanut Butter $3.29 Coffee $3.19 Green Tea $4.99 BBQ Sauce $2.99 Oil $6.69 Mayonnaise $4.59 Mustard $2.99 1. Compute the sample mean x and the sample standard...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese $3.29 Butter $4.99 Eggs $3.49 Yogurt $3.49 Juice $3.89 Tea $3.69 Chips $3.99 Soda $1.99 Pastry $2.99 Cerrial $4.99 Oats $3.29 Almond Milk $2.79 Almonds $4.39 Popcorn $3.29 Crackers $3.59 Ice Cream $6.99 Cookies $2.99 Jam $3.69 Peanut Butter $3.29 Coffee $3.19 Green Tea $4.99 BBQ Sauce $2.99 Oil $6.69 Mayonnaise $4.59 Mustard $2.99 1. Compute the sample mean x and the sample standard...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese $3.29 Butter $4.99 Eggs $3.49 Yogurt $3.49 Juice $3.89 Tea $3.69 Chips $3.99 Soda $1.99 Pastry $2.99 Cerrial $4.99 Oats $3.29 Almond Milk $2.79 Almonds $4.39 Popcorn $3.29 Crackers $3.59 Ice Cream $6.99 Cookies $2.99 Jam $3.69 Peanut Butter $3.29 Coffee $3.19 Green Tea $4.99 BBQ Sauce $2.99 Oil $6.69 Mayonnaise $4.59 Mustard $2.99 1. Compute the sample mean x and the sample standard...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese...
Here are some prices for randomly selected grocery items from the grocery store: Items Prices: Cheese $3.29 Butter $4.99 Eggs $3.49 Yogurt $3.49 Juice $3.89 Tea $3.69 Chips $3.99 Soda $1.99 Pastry $2.99 Cerrial $4.99 Oats $3.29 Almond Milk $2.79 Almonds $4.39 Popcorn $3.29 Crackers $3.59 Ice Cream $6.99 Cookies $2.99 Jam $3.69 Peanut Butter $3.29 Coffee $3.19 Green Tea $4.99 BBQ Sauce $2.99 Oil $6.69 Mayonnaise $4.59 Mustard $2.99 1. Compute the sample mean x and the sample standard...
A customer has purchased 15 items in a department store.
A customer has purchased 15 items in a department store. Write a code segment to read the unit price and the quantity of each these 15 items and to compute and print its price (which is the unit price times the quantity). Also compute and print average price of the 15 items.
Assume that a customer shops at a local grocery store spending an average of ​$150 a​...
Assume that a customer shops at a local grocery store spending an average of ​$150 a​ week, resulting in the retailer earning a ​$25 profit each week from this customer. Assuming the shopper visits the store all 52 weeks of the​ year, calculate the customer lifetime value if this shopper remains loyal over a​ 10-year life-span. Also assume a 4 percent annual interest rate and no initial cost to acquire the customer. This customer yields ​$1300 per year in profits...
Assume that a customer shops at a local grocery store spending an average of ​$400 a​...
Assume that a customer shops at a local grocery store spending an average of ​$400 a​ week, resulting in a retailer profit of ​$40 each week from this customer. Assuming the shopper visits the store all 52 weeks of the​ year, calculate the customer lifetime value if this shopper remains loyal over a​ 10-year life span. Also assume a 3 percent annual interest rate and no initial cost to acquire the customer. The customer yields ​$ nothing per year in...
The mean amount purchased by each customer at Churchill’s Grocery Store is $28 with a standard...
The mean amount purchased by each customer at Churchill’s Grocery Store is $28 with a standard deviation of $7. The population is positively skewed. For a sample of 49 customers, answer the following questions: a. What is the likelihood the sample mean is at least $29? (Round the z-value to 2 decimal places and the final answer to 4 decimal places.) Sample mean             b. What is the likelihood the sample mean is greater than $26 but less than...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT