I have the following CashRegister class where i must implement 3 methods:
-getSalesTotal total up sales for the day
-getSalesCount total number of sales for the day
- rest a reset method that returns all instance variables to 0
Here is my code any help on mistakes i may have made is great, but my real problem is that i keep getting missing return statement when i try to compile the program. TY
/**
A cash register totals up sales and computes change due.
*/
public class CashRegister
{
private double purchase;
private double payment;
private double purchaseTotal;
private double purchaseCount;
/**
Constructs a cash register with no money in it.
*/
public CashRegister()
{
purchase = 0;
payment = 0;
purchaseTotal = 0;
purchaseCount = 0;
}
/**
Records the sale of an item.
@param amount the price of the item
*/
public void recordPurchase(double amount)
{
double total = purchase + amount;
purchase = total;
purchaseCount++;
purchaseTotal = purchaseTotal + total;
}
/**
Enters the payment received from the customer.
@param amount the amount of the payment
*/
public void enterPayment(double amount)
{
payment = amount;
}
/**
Computes the change due and resets the machine for the next customer.
@return the change due to the customer
*/
public double giveChange()
{
double change = payment - purchase;
purchase = 0;
payment = 0;
return change;
}
/**
Get the total amount of all sales for the day.
@param return sale total
*/
public double getSalesTotal(double salesTotal)
{
salesTotal = purchaseTotal;
}
/**
Get the total number of sales for the day.
@param return the number of sales.
*/
public double getSalesCount(double salesCount)
{
salesCount = purchaseCount;
}
/**
Reset counters and totals for the next days sales.
@param none
*/
public void reset(double resetComplete)
{
purchaseCount = 0;
purchaseTotal = 0;
purchase = 0;
payment = 0;
resetComplete = purchase + payment + purchaseTotal + purchaseCount;
}
}