Skip to content

Instantly share code, notes, and snippets.

@els-pnw
Created September 7, 2012 14:54
Show Gist options
  • Save els-pnw/3666851 to your computer and use it in GitHub Desktop.
Save els-pnw/3666851 to your computer and use it in GitHub Desktop.
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;
}
}
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