Name: ______

Identifier: ______

Program: Menus

Modify the previous program to fulfill the following specifications.

Specifications:

The customer can choose to buy either apples, grapes, or candy bars. Present the user with the exact menu:

1 Apples

2 Grapes

3 Candy Bars

4 No Purchases

The user will then be prompted to enter the quantity for the item he wishes to purchase.

  • The prices for all items are the same as in Assignment #4 with the following exception. If the user desires to purchase grapes, also ask him for the three-letter abbreviation for the current month (e.g. Jan, Jun, Sep, etc.). If the month is Dec, Jan, or Feb, use the price of $2.00 per pound of grapes rather than $1.25.
  • Candy bars are still taxed with the 6% MI state sales tax rate.
  • The customer may choose menu option #4, exiting the program immediately without making any purchase.
  • Your program must display an output message along with the total amount due.
  • The very first line of your output (before the user makes any inputs) must be your name so that the instructor can easily identify your program when he executes it. You must use a switch structure for your menu.

Be sure to ask the instructor about the specifications above if you have any questions since the first step of the Programming Process is to "define the problem and understand the given specifications".

Submission Requirements:

  • Write a test plan and the pseudocode before you begin to write the code.
  • You must choose the proper variable data types for your variables so that the final answer is accurate.
  • Include explanatory input prompt messages where appropriate so that the user knows exactly what to type as inputs.
  • Make sure that your answer is explained with a clearly worded, explanatory output message as well.
  • Present the final cost as a number rounded to the hundredth's place (e.g. $78.65) and include a dollar symbol. Make sure that trailing zeros do display (eg. $2.80 rather than $2.8; hint - use setprecision).
  • Save the source code file as "Assignment3.cpp". There should be no blank spaces and no # symbol in the filename.

Assumptions:

  • 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.
  • You are guaranteed that the user will type a valid three-letter month abbreviation without a period such as Jan, Feb, Mar, Apr, etc. The first letter will be a capital.
  • You are guaranteed that the user will type allowable inputs from the menu (i.e. 1, 2, 3, or 4).

Logistics:

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

  1. The typed pseudocode that you used to plan out your C++ code.
  2. A typed test plan that you developed.
  3. Make sure that you use this test plan to test your program before submitting it
  4. Hardcopy source code for this assignment.
  5. Staple multiple pages together, if applicable.
  6. The source file saved on a floppy disk or attached to an email as Assignment5.cpp. It is very important that you name the file as Assignment5.cpp. 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.

assignment5_menusCPS120: Assignment 3Page: 1 / 2