-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
59 lines (40 loc) · 1.95 KB
/
Bank.java
File metadata and controls
59 lines (40 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//Program Name: Bank.java - Creates BankAccount objects and CheckingAccount objects
//Use in Inheritance discussion/assignment -Starting File
//Author: P. Baker and Joshua Decker
//Date: 4/17/2022
//Brief Description: Tests the BankAccount and CheckingAccount classes.
package ch12;
public class Bank
{
public static void main( String [ ] args)
{
System.out.println("Welcome to our Bank");
//create BankAccount object
BankAccount myAcct = new BankAccount();
System.out.println("\nA Bank Account");
System.out.println("Beginning state of myAcct: " + myAcct.toString( ) );
myAcct.deposit(100);
myAcct.withdraw(25);
System.out.println("The balance of myAcct after deposit/withdraw : " + myAcct.getBalance( ) );
System.out.println("\nA Checking Account");
CheckingAccount studentAcct = new CheckingAccount();
System.out.println("Beginning state of studentAcct: " + studentAcct.toString());
studentAcct.deposit(50.00);
System.out.println("State of studentAcct after deposit: " + studentAcct.toString());
studentAcct.setTransactionFee(5.00);
studentAcct.deposit(15.00);
System.out.println("State of studentAcct after setting transaction fee and deposit: " + studentAcct.toString());
System.out.println("Number of BankAccount objects created: " + BankAccount.getAcctCount());
}
}//end of Bank
/*
Welcome to our Bank
A Bank Account
Beginning state of myAcct: acctNumber 0 balance : $0.00 name : Unknown
The balance of myAcct after deposit/withdraw : 75.0
A Checking Account
Beginning state of studentAcct: acctNumber 0 balance : $0.00 name : Unknown transaction fee = $1.00
State of studentAcct after deposit: acctNumber 0 balance : $49.00 name : Unknown transaction fee = $1.00
State of studentAcct after setting transaction fee and deposit: acctNumber 0 balance : $59.00 name : Unknown transaction fee = $5.00
Number of BankAccount objects created: 2
*/