Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Output reads: Choose from the following: A. Pencils B. Pens C. Erasers D. Rulers E. Exit Enter your selection: (user inputs selection) Quantity: (user inputs

image text in transcribedimage text in transcribed

Output reads:

Choose from the following:

A. Pencils

B. Pens

C. Erasers

D. Rulers

E. Exit

Enter your selection: (user inputs selection)

Quantity: (user inputs quantity)

Receipt

Cost per item: (depends on above choice)

Number of Items purchased: (quantity)

Discount Rate: (15% if quantity is 100 or more, 0% if less)

Sales Tax: 7.5%

Total amount owed: ( answer from calculateBill function)

If user inputs choice 'E'

Output is :

Choose from the following:

A. Pencils

B. Pens

C. Erasers

D. Rulers

E. Exit

Enter your selection: (user inputs selection)

If user inputs any character other than a, b, c, d, or e output is:

Choose from the following:

A. Pencils

B. Pens

C. Erasers

D. Rulers

E. Exit

Enter your selection: (user inputs selection)

Invalid Selection

CS 145 Spring 2019 Programming Assignment 1 Due Date: Friday March 8, 11:55 PM- 50 pts Description Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a pencil is 12 The cost of a pen is 16c The cost of an eraser is 22 The cost of a ruler is 40d There is a discount based on the quantity purchased. If you purchase a 100 or of any one item you get a 15% discount After the cost is determined, there is a 7.5% sales tax Th e program should have the following functions: displayMenuGetSelection- This function displays the menu to the screen processOrder- This function has the cost needed to process the order getValidQuantity This function asks the user to type in the quantity calculateBill This function has the cost and quantity passed in. It and asks the user to enter their selection. It returns the selection as a character. passed in. It then calls the functions to get a valid quantity, calculates the bill and prints the receipt. It does not return a value It makes sure that the quantity is a positive value and then returns the positive integer. also determines the discount, so that is passed in, too. The function determines the discount rate and calculates the cost that is due. It returns the cost that is due determineDiscount This function is called from within calculateBil1. It uses the quantity passed in 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 main main only calls two methods displayMenuGetSelection and processOrder. It has a switch statement and calls processOrder with the appropriate price constant as an argument Requirements 1. The program must be called main.cpp 2. If the program does not compile, it is a zero 1/ 2 CS 145-S 2019 3. Submit the C+ file to moodle by the due date. If the incorrect file is submitted it will be a zero (Check to make sure the correct file is uploaded) pencil, the cost of a pen, the cost of an eraser 4. There should be SIX constants: the cost of a the cost of a ruler, the tax, and the discount 5. Your output should be identical (except for your name) to the output given when the input given is | typed in, this includes spacing 6. Comments should be at the top of all files that you turn in with your name, class, etc. 7. You must use a switch statement in main 8. Th e program should compute the correct answer for all proper input. The output given does NOT |r"-........... test all possibilities, but the program should work for all input Words of Wisdom 1. Do NOT enter all of the program in at one time | . and then compile and run it 2. DO NOT WAIT UNTIL THE LAST MINUTE!!!! | ...-., Things come up with computers. Try to start assignments as soon as you get them

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

What is the formula to calculate the mth Fibonacci number?

Answered: 1 week ago

Question

I receive useful feedback about my performance.

Answered: 1 week ago

Question

I am encouraged to offer opinions/suggestions.

Answered: 1 week ago