Question: PARTICIPATION 8 . 6 . 2 : Rearrange the code to provide two additional CashRegister methods. Full screen ACTIVITY Rearrange the code below to provide
PARTICIPATION
: Rearrange the code to provide two additional CashRegister methods.
Full screen
ACTIVITY
Rearrange the code below to provide two additional CashRegister methods: an enterpayment method that reduces the to price by the given payment, and a givechange method that returns the change due and resets the total price and item count. Not all lines are useful.
How to use this tool
Unused
public double givechange
public void giveChange
totalPrice ;
itemCount ;
return change;
return totalPrice;
double change totalPrice;
double change totalPrice;
amount amount totalPrice;
CashRegister.java
Load default template.
private double totalPrice ;
private int itemCount ;
public void addItemdouble price
totalPrice totalPrice price ;
itemCount;
public int getCount
q
return itemCount;
public double getTotal
return totalPrice;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
