So I have a class project for school and I have to make a bank account program, everything runs smoothly until I hit the while loop, and then it gets stuck in an infinite loop, not executing anything, please help, the code is the following
import java.util.Scanner;
public class Blueprint_ET
{
//initialize all variables in the object
private double balance;
private double interestRate;
private double years;
private String name;
private int age;
private int validAmount;
private double initialBalance;
//construct the objects with the following variables
public Blueprint_ET(double balance, String name, int age){
years=0;
interestRate=.02;
this.balance=balance;
this.name = name;
this.age= age;
initialBalance = balance;
}
//deposit method
public void deposit(double depositAmt){
balance+=depositAmt;
}
//withdraw method
public void withdraw(double withdrawAmt){
balance-=withdrawAmt;
}
//method used to set the account years and add the interest accordingly
public void setYearsAndAddInterest(double years){
this.years=years;
double interestEarned = (interestRate * years) * balance;
balance += interestEarned;
}
//method used to get the name so that it can be printed out later on
public String getName(){
return name;
}
//method used to get the initial balance so that it can be printed out
public double getStarting(){
return initialBalance;
}
//method used to get the years so that it can be printed out
public double getYears(){
return years;
}
//method used to get the final balance once the account it closed
public double getFinal(){
return balance;
}
//method used to get the age of the person
public int getAge(){
return age;
}
public static void main(String[] args){
//create "kboard" scanner
Scanner kboard = new Scanner(System.in);
//ask the user to enter the persons first name
System.out.print("Enter the account owners first name here: ");
String firstName = kboard.nextLine();
//ask the user to enter the persons last name
System.out.print("Enter the account owners last name here: ");
String lastName = kboard.nextLine();
//puts together the first and last name into one variable
String fullName = firstName + " " + lastName;
//asks the user for the starting balance of the account
System.out.print("Enter the starting balance of the account here: ");
double balance = kboard.nextDouble();
//asks the user for the age of the person
System.out.print("Enter the age of the person here: ");
int age = kboard.nextInt();
//initialize variables that will be used in the while loop
String option;
int exitNum=0;
double years=0;
double deposit=0;
double withdraw=0;
//Create account object
Blueprint_ET account1 = new Blueprint_ET(balance, fullName, age);
//start while loop
while (exitNum < 20 ){
//prompts the user to enter what option they want to do with according codes
System.out.print("To widthdraw, type wd, to deposit, type d, to change the number of years that the account has been open and add the according interest, type y, to close the account, type c.");
option = kboard.nextLine();
//if statement for entering the amount of money withdrawn if the option selected is the code for wd
if (option == "wd") {
System.out.print("Enter the amount you want to withdraw from the account: ");
withdraw = kboard.nextDouble();
account1.withdraw(withdraw);
}
//if statement for entering the years the account has been open and sets the years and adds the interest rate into the balance
else if (option == "y") {
System.out.print("Enter the years the person has had the account open: ");
years = kboard.nextDouble();
account1.setYearsAndAddInterest(years);
}
//if statement for entering the amount of money to deposit, adds it to balance
else if (option == "d") {
System.out.print("Enter the amount you want to deposit: ");
deposit = kboard.nextDouble();
account1.deposit(deposit);
}
//sets the exitNum to 21 so that it can exit the while loop
else if (option == "e") {
exitNum = 21;
}
}
//prints out all data once the account has been closed
System.out.println(account1.getName()+"'s is "+account1.getAge()+" had an account that had an intial balance of "+account1.getStarting()+". This account was open for "+account1.getYears()+" years. Also, when the account was closed, they had a balance of "+account1.getFinal());
}
}