Question: Please help! Thank you Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a
Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a pencil is 124 The cost of a pen is 16e The cost of an eraser is 22 There is a discount based on the quantity purchased. If you purchase a 100 or more total items you get a 15% discount After the cost is determined, there is a 7.5% sales tax lementatico 1. Implement the class for StoreOrder the UML given. Test each method to make sure they all work correctly PENCIL CoST: final double 12 PEN COST: final double: 1 -ERASER COST final double .22 Constructors - set al numerical values to zero and the string to an empty-numPencils: int string (unless there is a numPens: int formal parameter) -companyName:String -numErasers:int Accessors return the value +StoreOrderO StoreOrder(companyName: String) of what is being accessed passed in to the field of the order add methods add the num O:String compute-computes the cost getNumPensils():int getNumPensO:int getNumErasersOint +addPencils(num:int): void +addPens(num:int): void addErasers(num:int): void computeCostO double Once the class is working, create a Main class and a main method. The following should be declare as instance variables for the Main class. public static final double TAX RATE -.075; public static final int DISCOUNT = 15; public static Scanner kb -new Scanner (System.in) The main method should produce the output given below. Is should call the following methods displayMenuGetSelection- This method displays the menu to the screen and asks the user to enter their selection. It returns a character. getValidInput - This method asks the user to type in the integer value for quantity. It makes sure that the quantity is a positive value and then returns it determineDiscount This method returns an integer value for the discount. A StoreOrder object is passed in to the method and the method returns the constant discount or zero, depending on whether there is a discount or not calculateAndPrintReceipt A StoreOrder object is passed into the method. This method calls the method to compute the cost in the class, and the determine Discount method. It computes costs and prints the receipt as shown in the output 1. If the program does not compile, it is a zero. 2. Submit the two java files to moodle by the due date. If the incorrect files are submitted it will be a zero. (Check to make sure the correct files are uploaded) 3. There should be FIVE constants: the cost of a pencil, the cost of a pen, the cost of an eraser (in the StoreOrder class) and the tax and the discount (in 4. Your output should be identical (except for your name) to the output given 5. Comments should be at the top of all files that you turn in with your name, 6. You must use a switch statement in main to determine which choice the user the Main class) when the input given is typed in, this includes spacing. class, etc. selected and to call the method to add to the appropriate field in the object output given does NOT test all possibilities, but the program should work 7. The program should compute the correct answer for all proper input. The for all input 1. Do NOT enter all of th 2. DO NOT WAIT UNTIL THE LAST MINUTE!!I Things come up with e program in at one time and then compile and run it computers. Try to start assignments as soon as you get them. Sample Outputs
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
