Created
September 7, 2012 14:54
-
-
Save els-pnw/3666851 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CashRegister { | |
public static int registers = 0; | |
public int transactions = 0; | |
public double amount = 0.00; | |
public CashRegister() { | |
registers = registers + 1; | |
} | |
public double AddTransaction(double a) { | |
amount = amount + a; | |
return amount; | |
} | |
public static int RegisterCount() { | |
return registers; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CashRegister; | |
public class UseCashRegister { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
CashRegister register = new CashRegister(); | |
System.out.println("Number of Registers:" + register.RegisterCount()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment