Question: import java.util.Scanner; public class bankAccountProcessloop{ public static void main(String[]Args) { Scanner input = new Scanner(System.in); double count = 0; String name; name = David p

import java.util.Scanner;

public class bankAccountProcessloop{ public static void main(String[]Args) { Scanner input = new Scanner(System.in); double count = 0; String name; name = "David p" ; System.out.println(" input first and last name or type stop to end the program "); name = input.nextLine(); input.nextLine(); while (!name.equals ("stop") ) { if (count >= 1) { System.out.println(" input first and last name or type stop to end program "); input.nextLine(); name = input.nextLine() ; } if (name.equals ("stop")){ break; } count = 1; double deposit = 0; double interest = 0; System.out.print("To open checking type 1. To open savings type 0."); double answer = input.nextDouble(); input.nextLine(); 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)); } } } }

hi this is my java code and i am tying to run a while loop but it keeps looping before I want it to. can anyone help me figure out to make it run correctly please.

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!