Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Therron Telford
- AP CS A
- October 14, 2017
- */
- public class AccountBalance {
- private double balance;
- private double deposit;
- private double withdrawal;
- public AccountBalance(){
- }
- public AccountBalance(double bal, double dep, double with){
- balance = bal;
- deposit= dep;
- withdrawal= with;
- balance = balance + deposit - withdrawal;
- }
- public void setBalance(double beginning){
- balance = beginning;
- }
- public double myBalance(){
- return balance;
- }
- public void myWithdrawal(double withdraw){
- withdrawal = withdraw;
- balance = balance - withdrawal;
- }
- public void myDeposit(double dep){
- deposit = dep;
- balance = balance + deposit;
- }
- public String toString(){
- return "My balance is " + balance;
- }
- }
- /* in the main of AccountBalanceTest
- * AccountBalance mine = new AccountBalance();
- * mine.balance(100);
- * mine.deposit(800);
- * mine withdrawal(150);
- * System.out.println(mine);
- */
- //How many constructors? Accessor? Mutator?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement