chore: remove unused repl-related configuration and placeholder files
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
class BankAccount {
|
||||
public String holder;
|
||||
public double balance;
|
||||
public BankAccount(String name, double initial) {
|
||||
this.holder = name;
|
||||
this.balance = initial;
|
||||
}
|
||||
public void deposit(double amount) {
|
||||
if (amount > 0) {
|
||||
this.balance = this.balance + amount;
|
||||
}
|
||||
}
|
||||
public boolean withdraw(double amount) {
|
||||
if (amount > 0 && amount <= this.balance) {
|
||||
this.balance = this.balance - amount;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public double getBalance() {
|
||||
return this.balance;
|
||||
}
|
||||
public String info() {
|
||||
return this.holder + ": $" + this.balance;
|
||||
}
|
||||
}
|
||||
|
||||
BankAccount acc = new BankAccount("Alice", 1000.0);
|
||||
acc.info()
|
||||
acc.getBalance()
|
||||
|
||||
acc.deposit(500.0)
|
||||
acc.getBalance()
|
||||
|
||||
acc.withdraw(200.0)
|
||||
acc.getBalance()
|
||||
|
||||
acc.withdraw(2000.0)
|
||||
acc.getBalance()
|
||||
|
||||
acc.info()
|
||||
|
||||
%classes
|
||||
%whos
|
||||
%quit
|
||||
Reference in New Issue
Block a user