Question: A new company asks you to write a program to calculate the number of items sold and the total amount they should receive for past
A new company asks you to write a program to calculate the number of items sold and the total amount they should receive for past four weeks, weekly average amount and the estimated annual amount (Assume each year = 52 weeks). The company sales 4 items: Hats for $19.99 each. sunglasses for 28.89 each, bikinis for 45.79 each, and lotions for $25.29 each.
Write a C++ program to calculate the number of items sold after 4 weeks, their total amount after 4 weeks, the weekly average, and estimated annual amount. Make sure to use a loop to get the user input and to calculate number of sold items for each week.
The number of items sold at the ned of the each week will be recorded as four numbers: The numbers of hats, sunglasses, bikinis, and locations sold. If an input number is negative, consider it as a zero in your calculation.
After each run, ask the user to Q or q to quit or type any other key to repeat the loop and perform another calculation. Dont forget to add comments to your code. Make sure the interaction with user matches the following sample input and out put (the bold contents are entered by user).
Note: Do not create 16 variables to gather weekly information. Do not use global variables. Do not use arrays.
Sample input and output:
Number of hats, sunglasses, bikinis and lotions sold in week 1: 11 5 0 5
Number of hats, sunglasses, bikinis and lotions sold in week 2: 9 8 1 12
Number of hats, sunglasses, bikinis and lotions sold in week 3: 8 2 3 12
Number of hats, sunglasses, bikinis and lotions sold in week 4: 10 4 8 15
After 4 weeks, you sold 38hat(s), 19 sunglasses, 12 bikini(s), and 44 lotion(s).
Total amount after 4 weeks: $2970.77
Weekly average amount: $742.69
Estimated annual amount: $38620.01
Another calculation? (Enter any key to continue or enter Q or q to quit): Q
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
