Modify the Previous Assignment to Fulfill the Following Specifications

Modify the Previous Assignment to Fulfill the Following Specifications

Program: Structure

Modify the previous assignment to fulfill the following specifications.

Specifications:

The program must use a loop to present the customer with the following menu allowing him to make one order of each 3 products if he desires.

1 Apples

2 Grapes

3 Candy Bars

4 Checkout

For example, the customer could order 3 apples and 4 pounds of grapes. Or, the customer could order 5 apples, 1 pound of grapes, and 3 candy bars.

  • The customer will now choose menu option #4 to exit at any time, even if he has made no purchase.
  • The customer should not be allowed to order the same product twice (within the same program execution). If he does choose the same menu choice a second time, prompt him with a message indicating that he cannot make two orders for the same product and display the menu again.
  • Do not allow the customer to make any order that would cause the total amount of purchases to go over $100. If he attempts to place an order for an item that would cause the running total to exceed $100, present a message that tells him that he can only spend $100 or less and present him with the menu again.
  • He may place another valid order for the item that he attempted to purchase.
  • If the user has purchased all three items, the program should automatically display the total rounded price as if the user selected the Checkout menu choice.
  • For this assignment, assume that the price of grapes is simply $1.25 per pound no matter what the month

Submission Requirements:

1) Write a test plan and the pseudocode before you begin to write the code or type the code into C++.

2) Coding Requirements:

a) Your program must still display an output message along with the total amount due rounded to the hundredth's place and be sure to include a dollar symbol. Make sure that trailing zeros do display (eg. $2.80 rather than $2.8; hint - use setprecision).

b) When your program executes, your name should appear on the very first line of output so that the instructor can easily identify your program.

c) You must also use at least three functions (besides the main function) to demonstrate modular, structured programming. You must use a function named computeSalesTax with the function prototype

double computeSalesTax(double price);

This function should receive the price of a taxable item as a double and it should return the amount of the tax on that item. The function should not return the total price with the tax included.

  • The program must also use a void function named menu that uses the function prototype

void displayMenu();

The displayMenu function should only display the menu choices. It should not prompt the user to input a menu choice. Nor should it contain a cin statement that obtains the user's menu choice input. You must also use a function that rounds a value to the nearest hundredths place named roundToPenny.

Assumptions:

  1. You are guaranteed that the user will type reasonable whole numbers that are greater than 0 and less than 100 for the number of apples, grapes, or candy bars.
  2. You are guaranteed that the user will type allowable inputs from the menu (i.e. 1, 2, 3, or 4).
  3. For this assignment, assume that the price of grapes is simply $1.25 per pound no matter what the month

Logistics:

You must hand in the following on separate pages stapled in this specified order:

  1. Hardcopy of the source code for this assignment.
  2. Staple multiple pages together, if applicable.
  3. The pseudocode that you used to write out your C++ code.
  4. The test plan that you developed before writing out the code.
  5. Make sure that you use this test plan to test your program before submitting it.)
  6. The test plan must include several reasonable inputs as well as boundary and any other special values.
  7. You should include as many test cases as necessary so that the test plan is thorough
  8. You must also hand in the source file saved on a floppy disk or as an attachment to an email named Assignment6.cpp. It is very important that you name the file as Assignment4.cpp exactly. You will lose points if the file is named incorrectly. If submitted in that form, the floppy disk will not be returned to you after this assignment has been graded.