This repository was archived by the owner on Jun 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankAccountDriver.java
More file actions
54 lines (38 loc) · 1.55 KB
/
BankAccountDriver.java
File metadata and controls
54 lines (38 loc) · 1.55 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
/*BankAccountDriver.java
*
*Created by Jonathan Nielson and Faith Satterthwaite
*
*This program allows the user to create and manage a bank account by depositing and withdrawing at will.*/
import java.util.*;
public class BankAccountDriver
{
public static void main (String[] args)
{
Scanner in = new Scanner (System.in);
Random r = new Random ();
String preferredName = "";
int assignedAccount = 0;
int actionSelect = 0;
int amount = 0;
System.out.println("Welcome to Really Great Banking! Please enter your name to get started: ");
preferredName = in.nextLine();
assignedAccount = r.nextInt(99999);
System.out.println("Welcome, " + preferredName + ". Your new account is #" + assignedAccount + ".");
BankAccount b = new BankAccount (preferredName, assignedAccount);
do
{
System.out.println("Press 1 to make a deposit.");
System.out.println("Press 2 make a withdrawal.");
System.out.println("Press 3 to get account information.");
System.out.println("Press 4 to quit.");
actionSelect = in.nextInt();
if (actionSelect == 1)
{
System.out.println("Please enter the amount you would like to deposit: ");
amount = in.nextInt();
b.deposit(amount);
System.out.println("Your new balance is: " + b.getBalance);
}
} while (actionSelect != 4);
} //End of Main Method
} //End of Class