Hi I started Java 3 days ago and I'm doing a small bank account project to ask user for their name and balance and print out some messages based on the input. My problems start from trying to verify whether the user's name is correct. Anyway here's the code
//Code Starts package com.chief;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int minAmount = 500;
Scanner userInput = new Scanner(System.in);
/* String verifyName = "Yes";*/
System.out.println("Please enter your Account Name and Balance");
System.out.println("Account Name: ");
//Username here
String userName = userInput.nextLine();
System.out.println("Balance: ");
//Account balance here
double balance = userInput.nextDouble();
System.out.println("Account Name: " + userName);
// Verification
System.out.println("Please verify your username, enter Yes to accept or No to cancel");
String verifyName = userInput.nextLine();
while (verifyName.equals("Yes")) {
if (balance < 500) {
System.out.println("Your balance is below the minimum requirement of " + minAmount + " please top up");
System.out.println("Thank you for banking with King Solomon Bank");
}
if (balance > 500){
System.out.println("Good");
}
}
}
}
The program terminates after asking the user to input Yes or No but I think it worked the first time I tried. So I'm unable to enter that string
Also I was having troubles using the input for verifyName to run the while and if loops. Any help is greatly appreciated. Thanks