Results 1 to 3 of 3
  1. #1
    oneorderja is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Question 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();




    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default 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.

  3. #3
    oneorderja is offline Member
    Join Date
    Oct 2012
    Posts
    3
    Rep Power
    0

    Default 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

  1. error with CashRegister
    By End Of All in forum New To Java
    Replies: 6
    Last Post: 07-24-2012, 09:57 PM
  2. Need help with CashRegister program
    By Aimforthehead in forum New To Java
    Replies: 4
    Last Post: 11-13-2011, 11:29 PM
  3. Need help with java Printing Receipt
    By gilboy in forum New To Java
    Replies: 4
    Last Post: 10-26-2011, 02:10 PM
  4. Deleted Class template code. Now I cant make class.
    By AcousticBruce in forum IntelliJ IDEA
    Replies: 0
    Last Post: 01-11-2011, 11:52 PM
  5. Receipt project....(Beginner plz help)
    By waklo99 in forum New To Java
    Replies: 0
    Last Post: 03-16-2010, 08:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •