Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[IN JAVA] Really, really need help in getting this started and figuring out how to work through it. I will end up retyping it myself
[IN JAVA] 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)
Description Write a program that will compute the amount owed to a school supply store. Information to know: The cost of a pencil is 12c The cost of a pen is 166 The cost of an eraser is 22 The cost of a ruler is 40c 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 Implementation 1. Implement the class for StoreOrder the UML qiven. Test each method to make sure they all work correctly. -PENCIL_CoST: final double : .12 PEN_COST: final double 16 -ERASER_COST final double:.22 Constructors - set all 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 add methods - add the num compute - computes the cost '9e +StoreOrderO) +StoreOrder(companyName:String) of what is being accessed passed in to the field of the order +getCompanyName0:String +getNumPencils():int getNumPensO:int getNumErasersO:int -addPencils(num:int): void -addPens(num:int): void -addErasers(num:int): void +computeCost):double Cs 140 Spring 2019 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 outputStep 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