I want to modify the Cash Resigter Code below to create a file containing a sales receipt. The program should ask the user for the quantity of items being purchased, and then generate a file with contents below:
SALE RECEIPT
Unit Price : $10.00
Quantity: 5
Subtotal: $50.00
Sales Tax: $3.00
Total: $53.00
Here is my code:
public class CashRegister
{
private RetailItem retailItem;
private int quantityItems;
private final double SALES_TAX = .06;
private int subTotal;
private double price;
public CashRegister ()
{
quantityItems = 0;
subTotal = 0;
}
public CashRegister(RetailItem retailObject, int quantity)
{
price = retailObject.getPrice();
quantityItems = quantity;
}
public RetailItem getRetailItem()
{
return new RetailItem();
}
public double getSubTotal()
{
return quantityItems * retailItem.getPrice();
}
public double getTax()
{
return SALES_TAX;
}
public double getTotal()
{
return subTotal + SALES_TAX;
}
}