Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Q6
  2. {
  3.  public static void main(String[] args)
  4.  {
  5.        
  6.       int p1 = 70;
  7.       int p2 = 60;
  8.       DrinksMachineA machine1 = new DrinksMachineA(p1);
  9.       DrinksMachineA machine2 = new DrinksMachineA(p2);
  10.      
  11.      
  12.      
  13.       calc(machine1,machine2);
  14.  
  15.  }
  16.  
  17.  public static DrinksMachineA calc(DrinksMachineA mach1, DrinksMachineA mach2)
  18.  {
  19.     if(mach1.collectCash()>mach2.collectCash()){
  20.         System.out.println(mach1 + " has more cash than " + mach2);
  21.     }
  22.     else if(mach1.collectCash()<mach2.collectCash()){
  23.         System.out.println(mach2 + " has more cash than " + mach1);
  24.     }
  25.     return mach1;
  26.  }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement