Question
import java.util.Scanner; public class bankAccountProcess{ public static void main(String[]Args) { Scanner input = new Scanner(System.in); System.out.println( input first and last name or type stop to
import java.util.Scanner;
public class bankAccountProcess{ public static void main(String[]Args) {
Scanner input = new Scanner(System.in); System.out.println(" input first and last name or type stop to exit "); String name = input.nextLine(); double deposit = 0; double interest = 0; System.out.print("To open checking type 1. To open savings type 0."); double answer = input.nextDouble(); if (answer == 1){ System.out.println("If opening a checking account, you are required to open a Savings"); System.out.println("account with a minimum $100.00 deposit. Continue? Type 1 for yes or 0 for no"); answer = input.nextDouble(); } else { System.out.println("how much would you like to deposit into your new savings account."); double savings = input.nextDouble(); int savingsAccountnumber = (int)(Math.random() * 101) ; if( savings < 100.01){ System.out.println("initial deposit must be over $100. how much will you deposit?"); savings = input.nextDouble(); } if( savings < 501){ interest = .035; } else if ( savings < 1001){ interest = .045; } else { interest = .05; } System.out.printf("%-10s%-10s%-10s ", "Checking Acct:", " Savings Acct:" + savingsAccountnumber, " Estimated Savings balance in 1 Year"); System.out.printf("%-10s%-10s%-10s ", "deposit: ", " deposit:" + savings," " + (savings * interest + savings) ); System.out.println("Savings account has the higher initial deposit:" + Math.max(savings, 0)); } if (answer == 1){ System.out.println("how much would you like to deposit into your new savings account."); double savings = input.nextDouble(); int savingsAccountnumber = (int)(Math.random() * 101) ; if( savings < 100.01){ System.out.println("initial deposit must be over $100. how much will you deposit?"); savings = input.nextDouble(); } if( savings < 501){ interest = .035; } else if ( savings < 1001){ interest = .045; } else { interest = .05; } System.out.println("How much would you like to deposit into checking?"); double checking = input.nextDouble(); int checkingAccountnumber = (int)(Math.random() * 101) ; System.out.printf("%-10s%-10s%-10s ", "Checking Acct:" + checkingAccountnumber, " Savings Acct:" + savingsAccountnumber, " Estimated Savings balance in 1 Year"); System.out.printf("%-10s%-10s%-10s ", "deposit: "+ checking , " deposit:" + savings," " + (savings * interest + savings) ); if ( savings > checking){ System.out.println("Savings account has the higher initial deposit:" + savings); } else { System.out.println("Checking account has the higher initial deposit:" + checking); } } else { System.out.print("End program");} } }
im a beginner java programmer and i am trying to get nearly this entire program to automatically loop unless the name is "stop" can someone help with this please. i tried many times but i cannot get the entire program to loop starting from when it "asks to input user's name, or type stop to exit" all the way to the rest of the program
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started