Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(C++) Really, really need help in getting this started and figuring out how to work through it. I will end up retyping it myself to
(C++) Really, really need help in getting this started and figuring out how to work through it. I will end up retyping it myself to learn, but cannot figure out where to even start. (Brand new to programming). There should be SIX constants: the cost of a pencil, the cost of a pen, the cost of an eraser, the cost of a ruler, the tax, and the discount
CS 145 Spring 2019 Programming Assignment 1 Due Date: Friday March 8 1155 PM- 50 pts Write a program that will compute the amount owed to a school supply store Information to know The cost of a pencil is 12e The cost of a pen is 16 The cost of an eraser is 22 The cost of a ruler is 40 There is a discount based on the quantity purchased. If you purchase a 100 or more of any one item you get a 15% discount After the cost is determined, there is a 7.5% sales tax. The 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 andcalculates the cost that is due. It returns the cost that is due determineDiscount This function is called from within calculateB111 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 Choose from the following: A. Pencils . Pens C Erasers D. Rulers E. Exit Enter your selection: p Invalid Selection Choose from the following: A. Pencils . Pens . Erasers D. Rulers E. Exit Enter your selection: Quantity: 99 Receipt Cost per item: 16 mber of items purchased: 99 Discount Rate: 0.0 Sales Tax: 7.508 Total Imount Owed: $17.03 Choose from the following: A. Pencils B- eens C Erasers D. Rulers E. Exit Enter your selection: Quantity: 100 Receipt Cost per item: 22 umber of items purchased: 100 Discount Rate: 15.0 Sales Tax: 7.508 Total Jmount Oved: $20-10 Choose from the following: A. Pencils B. Pens CErasers D. Rulers E. Exit Enter your selection: D Quantity:-50 Quantity must be positive- Try Again:-4 Quantity must be positive- Try Again:-96 Quantity aust be positive Try gain: 1358Step 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