public class TicketMachine extends IntMain
{
// instance variables - replace the example below with your own
private int price;
private int balance;
private int total;
/**
* Constructor for objects of class price
*/
public TicketMachine(int ticketCost)//constructor
{
// initialise instance variables
price = ticketCost;
balance = 0;
total = 0;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public int getPrice()//accessor
{
// put your code here
return price;
}
public int getBalance(){//accessor
return balance;
}
public void insertMoney(int amount){//mutator
balance = balance+amount;
}
public void printTicket(){
System.out.println("############");
System.out.println("# The BlueJ Line");
System.out.println("# " + price + " cents.");
System.out.println("############");
System.out.println();
total=total+balance;
balance=0;
}