Question: Assignment Description: Write a program based on the description below that demonstrates your knowledge of how to write source code for a C++ program including
Assignment Description:
Write a program based on the description below that demonstrates your knowledge of how to write source code for a C++ program including comments, proper indentation, variables (choosing appropriate names, appropriate data types, and assigning values to each), and using arithmetic expressions, constants, casting, formatting output and getline(). Choose a good file name for your source file. You will be uploading your source file ( it must have the extension .cpp).
Read the description below and create a source file with a descriptive file name. The program will ask the user how many cookies were ordered and how many brownies were ordered. The program will also ask the user to input the price for each cookie and the price for each brownie. Additionally, the program will ask the user for the most popular flavor at the event. The program will calculate the total number of cookies and brownies. 20 cookies/brownies can fit in a decorative box. The program will calculate the number of boxes that are completely filled and calculate the number of cookies/brownies that will be left over.
The program will also calculate the percentage of the order which were cookies and the percentage of the order which were brownies, the cost for each, the subtotal, tax, and total after tax. Print the flavor which was most popular.
Comments
Read the whole assignment first. In your program, write a comment on top, briefly describing your program.
Constants
The tax rate for the sales will be 6.75%. Create a constant for the tax rate with the value 0.0675
Variables
Your program will have statements for declaring (or initializing) variables based on the description. All of your variables should be declared at the beginning of the main function.
User input - using cin, use getline() and cin.ignore(). Write informative prompts for the user to read.
The program will ask the user how many cookies were ordered, how many brownies were ordered. T
he program will also ask the user to input the price for each cookie and the price for each brownie.
Additionally, the program will ask the user for the most popular flavor at the event.
Arithmetic expression using the arithmetic operators
The program will calculate the total number of cookies and brownies.
20 cookies/brownies can fit in a decorative box. The program will calculate the number of boxes that are completely filled and calculate the number of cookies/brownies that will be left over.
The program will calculate
the percentage of the order which were cookies - take the number of cookies and divide by the sum of the number of cookies and brownies and multiply by 100
and the percentage of the order which were brownies - take the number of cookies and divide by the sum of the number of cookies and brownies and multiply by 100
the cost for the brownies is the number of brownies multiplied by the price of each brownie
the cost for the cookies is the number of cookies multiplied by the price of each cookie
the subtotal is the sum of the cost of the cookies plus by the cost of the brownies
tax is the subtotal multiplied by the tax rate
total after tax is the subtotal plus the tax amount
Printing
Print the calculated values in sentences or in a way that is clear and informative
format the percentages to show 1 digit after the decimal
format the monetary values to show 2 digits after the decimal.
Print the flavor which was most popular.
a sample is shown below.
The parts highlighted in green are examples of user input and should not be in your program.
Your prompts and output not need to be the same but the output must show the values described above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
