So below i have an issue that i cant wrap my head around as to why its not working. The first block of java code works exactly how i wanted it to (e.g. set salary amounts to whatever, and if its not in range give an error and repeat the initial question.)
My problem is this in the second block of code I assumed making a boolean again and emulating the above code to check whether or not my inputs were == "", and if not rinse and repeat like before but it doesnt? i wrote it out exactly the same (of course changing the values) but i simply cant get t to function. If anyone can help or point me toward the right path id appreciate it :)
//First Block.....
boolean salaryState = false;
while (salaryState == false){
System.out.print("Salary: ");
salary = (input.nextDouble());
if(salary >= 45000 && salary <= 49999) { //if salary amount in this range
this.coachCategory = "Junior"; //then set coaches category to this
salaryState = true;
}
else if(salary >= 50000 && salary <= 59999) { //if salary amount in this range
this.coachCategory = "Youth"; //then set coaches category to this
salaryState = true;
}
else if(salary >= 60000 && salary <= 70000) { //if salary amount in this range
this.coachCategory = "Senior"; //then set coaches category to this
salaryState = true;
}
else { //if invalid salary amount then print error
if (salary <= 45000 && salary >= 70000);
System.out.println("ERROR: Salary range needs to be within 45 000 - 70 000.");
//Second Block...
boolean isName = false;
while (isName == false) {
System.out.print("Name: ");
name = (input.nextLine());
if(name != "") {
this.name = name;
isName = true;
}
else {
if(name == "");
System.out.println("ERROR: Please enter a name.");
}