edu.pdx.cs.joy.net.BankAccount Maven / Gradle / Ivy
The newest version!
package edu.pdx.cs.joy.net;
/**
* A BackAccount
maintains a integer balance. It takes
* time to access accounts.
*/
public class BankAccount {
private int balance;
public int getBalance() {
try {
long time = (long) (Math.random() * 1000);
Thread.sleep(time);
} catch (InterruptedException ex) {
}
return this.balance;
}
public void setBalance(int balance) {
try {
long time = (long) (Math.random() * 1000);
Thread.sleep(time);
} catch (InterruptedException ex) {
}
this.balance = balance;
}
}