Advertisement
piffy

The Java Vending Machine: COIN

Nov 25th, 2013
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package vending;
  2.  
  3. /**
  4.  *
  5.  * @author prof.missiroli@gmail.com
  6.  */
  7. public class Coin {
  8.     int value;
  9.  
  10.     public Coin(int value) {
  11.         this.value = value;
  12.     }
  13.  
  14.     public int getValue() {
  15.         return value;
  16.     }
  17.    
  18.     public boolean isValid() {
  19.         if ( (value==200) || (value == 100) || (value == 50) || (value == 20) || (value ==10) )
  20.             return true;
  21.        
  22.         return false;
  23.     }
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement