Here is a typical session:
Vending Machine:
Currently containing 10 cans, and 5 bottles.
Current sales: $0
What do you want to buy? (1 for can, 2 for bottle, 0 for exit): 1
Vending Machine:
Currently containing 9 cans, and 5 bottles.
Current sales: $.60
What do you want to buy? (1 for can, 2 for bottle, 0 for exit): 2
Vending Machine:
Currently containing 9 cans, and 4 bottles.
Current sales: $1.60
What do you want to buy? (1 for can, 2 for bottle, 0 for exit): 2
Vending Machine:
Currently containing 9 cans, and 3 bottles.
Current sales: $2.60
What do you want to buy? (1 for can, 2 for bottle
public class VendingMachine1Main {
VendingMachine cansdrinks = new VendingMachineCansDrink(nofDrinks);
VendingMachine bottlesdrinks = new VendingMachinebottlesDrinks(nofDrinks);
int dollarbill;
int quarters;
int dimes;
int nickels;
}
public class void main VendingMachine1main{
VendingMachine machine= new VendingMachine();
Machine. fillup(10)cans; // fill up with ten cans
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("can Count= ");
System.out.println(machine.getcanCount());
Machine. fillup(5)bottles; //fill up with five bottle
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("bottle Count= ");
System.out.println(machine.getbottleCount());
}
public void{
Machine. fillup(9)cans; // fill up with ten cans
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("can Count= ");
System.out.println(machine.getcanCount());
Machine. fillup(5)bottles; //fill up with five bottle
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("bottle Count= ");
System.out.println(machine.getbottleCount());
}
public void {
Machine. fillup(9)cans; // fill up with ten cans
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("can Count= ");
System.out.println(machine.getcanCount());
Machine. fillup(5)bottles; //fill up with five bottle
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("bottle Count= ");
System.out.println(machine.getbottleCount());
}
public static void {
Machine. fillup(9)cans; // fill up with ten cans
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("can Count= ");
System.out.println(machine.getcanCount());
Machine. fillup(3)bottles; //fill up with five bottle
Machine. InsertToken();
Machine.InsertToken();
System.out.print("Token Count=");
System.out.println(Machine .getTokenCount());
System.out.print("bottle Count= ");
System.out.println(machine.getbottleCount());
}
}
}
Good bye.
this is the question ,and this is what I did or attempt to solve it please help me out
MOD EDIT :

New Topic/Question
Reply



MultiQuote




|