Question: Please write code for Discount Bill. MAKE SURE TO INCLUDE COMMENTS PLEASE For this Assignment, you need to meet ALL specifications for Chapter 9, Exercise

 Please write code for Discount Bill. MAKE SURE TO INCLUDE COMMENTS

PLEASE For this Assignment, you need to meet ALL specifications for Chapter

9, Exercise \#10, and pass all the tests used on the Practice-IT

auto testing system. For many of the Practice-IT Exercises, additional "hidden" Classes

Please write code for Discount Bill. MAKE SURE TO INCLUDE COMMENTS PLEASE

For this Assignment, you need to meet ALL specifications for Chapter 9, Exercise \#10, and pass all the tests used on the Practice-IT auto testing system. For many of the Practice-IT Exercises, additional "hidden" Classes are used, and for this particular one, the code behind the scene is: https://practiceit.cs.washington.edu/problems/bjp5/chapter9/GroceryBill.java But above does not meet the Iverson Class(datastructure)SubmissionRequirements Code from U.W. above, was not intended as a good example, for sure, as things like comments and constructors are missing. The author uses a more advanced "inner classes" to further hide and encapsulate the data structure. Obviously just wrote that code to make the Practice-IT site work. To help understand how these things are really supposed to work, I've extracted the following: Your solution must extend GroceryBill, so here's that Class: GroceryBill.java Class used only for the GroceryBill class We use Item.java for other exercises olic class Item \{ private string name; private double price; private double discount; public Item(String name, double price, double discount) \{ this. name = name; this.price = price; this. discount = discount; \} public double getprice( ) \{ return price; \} public double getDiscount() \{ return discount; \} private string valueTostring(double value) \{ String result ="1"+ Math.abs(value); if (result. indexof(".") == result. length() - 2) \{ result += "0"; \} result = "\$" + result; return result; \} public String tostring() \{ return name +"+ valueTostring(price) +"("+ tring (discount) + ")"; \} // Constructors and field added by Iverson // UW places fields at bottom, then changes for testing private String person; public Employee(String name) \{ person = name; 3 public Employee() \{ this("no name provided"); \} public string tostring() \{ return person; \} // remaining code below from U.W. public int getHours() \{ return baseHours; //40 hours/week \} public double getsalary( ) \{ return basesalary; //$40,000.00 \} public int getVacationdays() \{ return baseVacationDays; //10 days \} public string getVacationform() \{ return baseVacationForm; // yellow \} // From UW: // These are so that test cases can change the base values // and make sure that subclasses also change their values. // (Your code that you submit is NOT supposed to directly use, call, // or modify the values below! They are here only to help Practice-It // successfully test your code. Please ignore them.) private static int basehours =40; private double basesalary =40000.0; private int basevacationDays =10; private string basevacationform = "yellow"; public final void setBaseHours(int hours) \{ baseHours = hours; \} public final void setBasesalary(double salary) \{ basesalary = salary; \} public final void setBaseVacationdays(int days) \{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!