Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirements: Example: Description This assignment has two parts. For the first part, you are to rewrite assignment three using functions. (I have provided my solution
Requirements:
Description This assignment has two parts. For the first part, you are to rewrite assignment three using functions. (I have provided my solution to assignment 3) The functions to be written are described below The second part is make the program loop until the user decides to exit. A fifth choice, E Exit, should be added to the menu and when chosen, the program will stop executing. (You may NOT use exit or return O to do this.) While menus are usually do..while loops, you may find a while loop a little easier or this assignment displayMenuGetSelection- This function displays the menu to the screen and asks the user to enter their selection. It returns the selection getValidQuantity - This function asks the user to type in the quantity It makes sure that the quantity is a positive value and then returns the quantity entered determineIndividualCost This function determines the cost of the individual item that the user choose (which is the formal parameter) In other words if the argument is 'A', this functions would return the cost of a PENCIL, 12 cents. If the choice is not a valid choice, this function will return a -1 calculateBill - This function computes the total price and also determines the discount rate. The cost and quantity are needed for these calculations. The total cost is returned determineDiscount This function is called from within calculateBill. It uses the quantity to determine if there is a discount and returns the constant discount or zero, depending on whether there is a discount or not printReceipt - This prints the receipt to the screen. All values to be printed are needed Example:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started