Calling a class and a little confused
Hello, I am stuck here on an application...basically I am to set up a cash register and my first class is compiling correctly, however, when I try to call it...I believe I am missing something here. Can someone please point me in the right direction please? Or tell me where I should concentrate on?
Thank you so much
public class Register
{
//data fields
private double subTotal;
private final double SALES_TAX = .075;
private double total;
private double change;
private double salesTax;
private double cashPaid;
private int Item;
double Cost;
int Quantity;
//constructors
public void CashRegister()
{
int twentyBills = 2;
int tenBills = 2;
int fiveBills = 2;
int quarters = 8;
int dimes = 20;
int nickels = 40;
int pennies = 50;
}//End constructors
//Set and Get Methods for Item
public void setItem(int items)
{
Item = items;
}
public int getItem()
{
return Item;
}//End Set and Get Item
//Set and Get Methods for quantity
public void setQuantity(int quan)
{
Quantity = quan;
}
public int getQuantity()
{
return Quantity;
}//End Set and Get quantity
//Set and Get for Price
public void setCost(double price)
{
Cost = price;
}
public double getCost()
{
return Cost;
}//End Set and Get quantity
public void subTotal()
{
subTotal = Quantity * Cost;
}
public void SALEX_TAX()
{
salesTax = subTotal * SALES_TAX;
}
public void total()
{
total = subTotal + salesTax;
}
public void change()
{
change = cashPaid - total;
}
public void displayReceipt()
{
System.out.println("Item bought was " + Item);
System.out.println();
System.out.println("Sub total is " + subTotal);
System.out.println("Tax 7.5% of sub total is " + salesTax);
System.out.println("Cash paid is " + cashPaid);
System.out.println("Change given back is " + change);
}
}//End Class
public class TestRegister
{
public static void main(String [] args)
{
Register myRegister = new Register( );
//Get user input
Scanner keyboard = new Scanner(System.in);
System.out.print("What item would you like to purchase? Press 1 for socks, 2 for towel, or 3 for razor ");
Item = keyboard.nextLine();
System.out.print("How many would you like to purchase?");
Quantity = keyboard.nextInt();
System.out.print("What is the price?");
Cost = keyboard.nextDouble();
myRegister.displayMessage();
}//End Main
}//End Class