First, we create a bankAccount class with 4 instance variables we'll be using thorughout the program:
- int balance;
- int previousBalance;
- String customerName;
- String customerID;
underneath that, we create our bankAccount constructor with 2 params.
Next we create 3 methods that give our application functionaility yo do things.
- deposit(), withdraw() and getPreviousTransaction() are comprised of math equations that fulfill each of their expected functions.
- Later down the line the
int amount
variable will equalscan.nextInt()
- the user's next int input.
The first block of code executed that acts as our aesthetics in terminal
- initializes
char option
;
This methods also coninueously runs a do/while loop with 5 different switch options
Stylistically - I like to keep my Main clean as possible.
- Here, we create a new bankAccount instance and execute showMenu()
- Orgainization and style matter - easier to read and follow (by other and myself). Separation of concerns.
- It's easier to break down a program by looking at its smaller blocks of code.
- initialize -> constructor -> invoke
new
object