import java.io.*; class UseDrinksMachine7d { // Shows use of static method in separate class public static void main(String[] args) throws NumberFormatException, IOException { DrinksMachine machine1 = new DrinksMachineA(25); DrinksMachine machine2 = new DrinksMachineA(80); DrinksMachine cheaper; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int amount; System.out.print("How much do you want to put in a machine? "); amount = Integer.parseInt(in.readLine()); cheaper = DrinksMachineFuncs.cheapestMachine(machine1,machine2); cheaper.addMoney(amount); System.out.print("When you press the coke button on the cheaper machine "); System.out.println("you get: "+cheaper.pressCoke()); } }