Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[Java] Need assistance to fix run time error. I also would like help on how to make a LOOP structure to continue creating bank accounts

[Java] Need assistance to fix run time error. I also would like help on how to make a LOOP structure to continue creating "bank accounts" until a sentinel value is entered. Pretty much when STOP is entered, the program ends.

Run time error is due to a command all the way at the bottom which says System.out.printf("Estimated Savings balance in 1 Year: $", futureBalance);

image text in transcribedimage text in transcribedimage text in transcribed

import java.util.Scanner; import java.lang. Math; import java.math. RoundingMode; public class bankAccount Process 6 Et 7 public static void main(String[] args) { double interestRate; //generates random number accnt double x = + Math.random() * 100; int account Number = (int); Scanner myoj = new Scanner(System.in); System.out.print("Enter first name: "); //user input String first_Name = myoj.nextLine(): Scanner sc = new Scanner(System.in); System.out.print("Enter last name: "); //user input String last Name = sc.nextLine(); String full_Name = last_Name + ", " + first_Name; Scanner s = new Scanner(System.in); System.out.print("which type of account would you like to open Checking or Savings: "); //user input string acct_Type = s.nextLine(); //checks what method to use if(acctType.equals Ignorecase ("Checking")) { Checking (full_Name); }else{ Savings (full Name); ) 38 39 } //creates a checking account public static void Checking (String full_Name) { double deposit = 0.0; double checking_Deposit = 0.0; 1/generates random account number double x = + Math.random() * 100; int account Number = (int)x; int checking_Account_Number = (int); System.out.print("opening a checking account requires customers to open a savings account with a minimum deposit of $100.00."); Scanner sc = new Scanner(System.in); System.out.print("Would you like to continue (Y/N): "); String saving Acct = sc.nextLine(): 47 48 A if (saving_Acct.equalsignoreCase("Y") Il saving_Acct.equals IgnoreCase ("Yes")) { Scanner s = new Scanner(System.in); System.out.print("Enter the inital deposit to open a saving account: "); deposit = s.nextDouble(); Scanner obj = new Scanner(System.in): System.out.print("Enter the inital deposit for checking account: "); checking Deposit = obj.nextDouble(); Helse! //ends the program } 64 65 66 68 69 70 if (deposit > 100) double interest Rate = interestRate (deposit); //future balance calculation double futureBalance = (deposit * Math.pow((1 + interest Rate / 12), 12)); System.out.println(full_Name.toUpperCase()); System.out.println("Acot " + checking_Account_Number + Checking"); System.out.printf("deposit $8.2f", checking_Deposit); System.out.println("Acct $" + account Number + Savings"); System.out.printf ("Initial deposit: $8.2f", deposit); System.out.printf "Estimated Savings balance in 1 Year: $8.2F"+ futureBalance); if (checking_Deposit > deposit) { System.out.println("Checking account has the higher initial deposit"); Jelse System.out.println("Savings account has the higher initial deposit"); ) 79 80 81 82 83 Jelset System.out.println("Intial deposit requirement not meet" + " " + "No account opened"); 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 109 104 209 105 100 106 200 107 20 108 200 109 - 110 111 ) 7/calculates interest rate public static double interestRate (double deposit) { double interestRate; if (deposit > 1000:1) { interestRate = .05; Jelse if (deposit >500.1) { interestRate = .045; Jelse if (deposit >100.1) { interestRate = .035; Jelse! interestRate = .025; ) return interestRate; ) //creates saving account public static void Savings (String full_Name) { double deposit = 0.0; double checking_Deposit = 0.0; 1/generates random account number. double x = 1 + Math.random() * 100; int accountNumber = (int)x; int checking_Account_Number = 0; Scanner s = new Scanner(System.in); System.out.print("Enter the inital deposit to open a saving account: "); deposit = s.nextDouble(); ta - 114 115 116 -10 -1 117 118 - 119 - 120 121 - 122 123 124 125 126 127 //this checks parameters why doesnt this work???? if (deposit > 100) double interest_Rate = interestRate (deposit); //future balance calculation double futureBalance = (deposit * Math.pow((1 + interest_Rate / 12), 12)); System.out.println(full_Name.toUppercase ()); System.out.println("ACCE + checking_Account_Number); system.out.printf("deposit $8.2f", checking_Deposit); System.out.println("Acct " + accountNumber + " Savings"); System.out.printf("Initial deposit: $8.2f", deposit); System.out.printf ("Estimated savings balance in 1 Year: $", futureBalance); if (checking_Deposit > deposit) { System.out.println("Checking account has the higher initial deposit"); }else{ System.out.println("Savings account has the higher initial deposit": System.out.println("Savings account has the higher initial deposit"); } 127 128 129 130 131 132 133 134 }else{ System.out.println("Intial deposit requirement not meet" } " " + "No account opened"); 135 } 136 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago