Question: Java Let's update our program from last week (bankAccountSelection.java), updates include: (1) Get customer first and last name for customer (refer to section 4.4.5) (2)

Java

Let's update our program from last week (bankAccountSelection.java), updates include: (1) Get customer first and last name for customer (refer to section 4.4.5) (2) Get input for what type of account: SAVINGS or CHECKING, if a customer chooses to open a Checking account they must open a Savings account with a minimum deposit of $100 (refer to section 4.4.7 Comparing Strings) (3) Generate account numbers using the Math random() method (refer to section 4.2.5) (4) Compute which account has the maximum initial deposit (refer to section 4.2.4) (5) Determine which account has the most amount deposited to it (refer to section 4.2.4) (4) format output (refer to section 4.6)

Pseudocode

Problem Description

Write a program that opens a Customer Bank Account(s) and then outputs a formatted (Section 4.6) representation of the Customer's Banking Accounts Information. A customer must open a SAVINGS account if they wish to open a CHECKING Account. Minimum deposit in savings must be $100.01.

get input for: name (first and last), type of account they want to open (Checking or Savings), initial deposit.

use the Math.random() method to generate the bank Account number(s) (refer to section 4.2.5)

set the interestRate based on the initial deposit for Savings account ONLY:

0-$100 (inclusive) -> inital deposit must be over $100.00;

$100.01 - $500 (inclusive) -> interest rate = .035;

$500.01 - $1000 (inclusive) -> interest rate = .045;

anything over $1000.00 -> interest rate = .05.

Math max() method (section 4.2.4): Determine which account (Checking or Savings) has the highest initial deposit.

Output all the account information: name (format to all CAPS - reference table 4.7), account number, type of account (Checking/Savings), initial deposit and a calculation of future balance in 1 year for the Savings account ONLY. Display the account name that has the higher balance (i.e. use the Math max() method).

Example Output:

Name: TERRAIN, HERCULES

Acct: 1234 Checking Acct: 5678 Savings Estimated Savings balance in 1 Year

deposit: $400.00 deposit: $150.00 $226.66

Checking account has the higher initial deposit:

Example Output2:

Name: THRICE, TRINITY

Acct: 0 Acct: 8765 Savings Estimated Savings balance in 1 Year

deposit: $0.00 deposit: $150.00 $156.00

Savings account has the higher initial deposit:

Example Output3:

no accounts opened - initial deposit requirements not met.

My code:

import java.util.Scanner; public class Main { // testing main method public static void main(String[] args) { // create an instance for Scanner to take inputs from user Scanner input=new Scanner(System.in); // read initialDeposit as input from user System.out.print("Enter initial deposit: "); double initialDeposit=input.nextInt(); // create a random account number int accountNumber=((int)(Math.random()*100)); double interestRate=0.0; // calculate interestRate if(initialDeposit<=100) interestRate=0.025; else if(initialDeposit<=500) interestRate=0.035; else if(initialDeposit<=1000) interestRate=0.045; else interestRate=0.050; // calculate futureBalance double futureBalance=initialDeposit*Math.pow((1+interestRate/12),12); // print results System.out.println(""); System.out.println("Account number: "+accountNumber); System.out.println("Initial Deposit: "+initialDeposit); System.out.println("Interest Rate: "+interestRate); System.out.println("Accumulated value in 1 year: "+futureBalance); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!