subject

IMPORTANT NOTE: ThESE RULES WILL BE ENFORCED
File name matches Class name which starts with uppercase character.
It compiles with one of the Oracle Java compilers (javac. exe) using JDK5,6,7,or 8.
Import only java. and javax. classes, or other classes specifically covered in our text
Never submit specialized IDE specific code (e. g. from NetBeans) as I might run from command line.
Never submit those //TODO lines that your IDE (e. g. Eclipse) generates and you failed "to do."
Your name, course, date, and reasons for doing this appear in first few lines (/* comments */)
More lines of comments, using // style, so every screen has a few comments at all times.
Proper indent of code as described in textbook, for Class, methods, loops, decisions, etc...
Classes start with upper case, and object lower case, using reasonably descriptive names.
Good Boolean ZEN, and never let me see while(true) or if(true) as you can do better.
Your completed DiscountBill. java passes all Practice-IT tests and demonstrates:
using super in two constructors
using super. with at least two methods
Suppose a class GroceryBill keeps track of a list of items being purchased at a market:
Method/Constructor Description
public GroceryBill(Employee clerk) constructs a GroceryBill object for the given clerk
public void add(Item i) adds i to this bill's total
public double getTotal() returns the cost of these items
public void printReceipt() prints a list of items
GroceryBill objects interact with Item objects. An Item has the following public methods:
Method/Constructor Description
public double getPrice() returns the price for this item
public double getDiscount() returns the discount for this item
For example, a candy bar item might cost 1.35 with a discount of 0.25 for preferred customers, meaning that preferred customers get it for 1.10. (Some items will have no discount, 0.0.) Currently the above classes do not consider discounts. Every item in a bill is charged full price, and item discounts are ignored.
Define a class DiscountBill that extends GroceryBill to compute discounts for preferred customers. The constructor for DiscountBill accepts a parameter for whether the customer should get the discount.
Your class should adjust the amount reported by getTotal for preferred customers. For example, if the total would have been $80 but a preferred customer is getting $20 in discounts, then getTotal should report the total as $60 for that customer. You should also keep track of how many items a customer is getting a non-zero discount for and the overall discount, both as a total amount and as a percentage of the original bill. Include the extra methods below that allow a client to ask about the discount:
Method/Constructor Description
public DiscountBill(Employee clerk, boolean preferred) constructs discount bill for given clerk
public int getDiscountCount() returns the number of items that were discounted, if any
public double getDiscountAmount() returns the total discount for this list of items, if any
public double getDiscountPercent() returns the percent of the total discount as a percent of what the total would have been otherwise
If the customer is not a preferred customer the DiscountBill behaves at all times as if there is a total discount of 0.0 and no items have been discounted.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
question
Computers and Technology, 23.06.2019 13:50
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
question
Computers and Technology, 24.06.2019 13:10
Write a program that has a conversation with the user. the program must ask for both strings and numbers as input. the program must ask for at least 4 different inputs from the user. the program must reuse at least 3 inputs in what it displays on the screen. the program must perform some form of arithmetic operation on the numbers the user inputs. turn in your .py file as well as a screenshot of your program's output. include comments in your code to explain how it works an example program run might look like (have fun with this and be creative): ‘what is your name? ’ “josh” ‘, josh. what is your favorite color? ’ “green” ‘mine too. do you also like ice cream? ’ “no” ‘josh, how old are you? ’ “40” ‘ and how many siblings do you have? ’’ “3” ‘that means you are one of 4 kid(s). is green the favorite color of anyone else in your house? ’
Answers: 3
You know the right answer?
IMPORTANT NOTE: ThESE RULES WILL BE ENFORCED
File name matches Class name which starts with u...
Questions
question
Mathematics, 24.08.2019 00:00
question
Mathematics, 24.08.2019 00:00
Questions on the website: 13722363