Results 1 to 3 of 3
- 10-09-2012, 04:39 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 3
- Rep Power
- 0
Need help with the CashRegister Class to make a Sales Receipt?
Modifty the Cash Register Class to create a file containing a sales receipt. The program should ask the user for the quantity of the items being purchased and then generate a file with contents to similar to the following:
SALES RECEIPT
UNIT PRICE: 10.00
QUANTITY: 5
SUBTOTAL: 50
SALES TAX: 3
TOTAL: 53
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;
}
public String toString()
{
return " Unit Price:" + price + "Quantity:" + quantityItems;
}
}
import java.util.Scanner;
public class SalesReciept
{
public static void main (String [] args)
{
CashRegister register = new CashRegister();
}
}
-
Re: Need help with the CashRegister Class to make a Sales Receipt?
In a typical question in this forum the poster shows his attempt to solve a problem and then tells us how is code is currently not working or what errors it may be generating. You've posted requirements and code, but you've still left out important parts of your questions, parts that are necessary before we can help you.
- 10-09-2012, 04:59 AM #3
Member
- Join Date
- Oct 2012
- Posts
- 3
- Rep Power
- 0
Re: Need help with the CashRegister Class to make a Sales Receipt?
Ok im trying to modify the CashRegister Class to generate a Sales Receipt with the following :
SALES RECEIPT
UNIT PRICE: 10.00
QUANTITY: 5
SUBTOTAL: 50
SALES TAX: 3
TOTAL: 53
I created the Sales Receipt class and created an instance of the CashRegister, now have no idea where to move to next.
Thanks so much!!
Similar Threads
-
error with CashRegister
By End Of All in forum New To JavaReplies: 6Last Post: 07-24-2012, 08:57 PM -
Need help with CashRegister program
By Aimforthehead in forum New To JavaReplies: 4Last Post: 11-13-2011, 10:29 PM -
Need help with java Printing Receipt
By gilboy in forum New To JavaReplies: 4Last Post: 10-26-2011, 01:10 PM -
Deleted Class template code. Now I cant make class.
By AcousticBruce in forum IntelliJ IDEAReplies: 0Last Post: 01-11-2011, 10:52 PM -
Receipt project....(Beginner plz help)
By waklo99 in forum New To JavaReplies: 0Last Post: 03-16-2010, 07:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks