import javax.swing.JOptionPane;
public class Revision_Practical {
public static void main(String[] args) {
int years = getYears();
double salary = getSalary();
int increase = checkIncrement(years, salary);
}
public static int getYears() {
int years;
do {
String input = JOptionPane.showInputDialog(null,
"Please enter the number of years worked");
years = Integer.parseInt(input);
if (years <= 0) {
JOptionPane.showMessageDialog(null,
"Years worked must be more than 0. Please re-enter");
} else {
JOptionPane.showMessageDialog(null,
"The number of years worked is: " +
years);
}
} while (years <= 0);
return years;
} //end getYears
public static double getSalary() {
double salary;
do {
String input1 = JOptionPane.showInputDialog(null,
"Please enter the salary");
salary = Double.parseDouble(input1);
if (salary <= 0) {
JOptionPane.showMessageDialog(null,
"Salary must be more than 0. Please re-enter");
} else {
JOptionPane.showMessageDialog(null, "The salary is: " + salary);
}
} while (salary <= 0);
return salary;
} //end getSalary
public static int checkIncrement(int years, double salary) {
int increase = 0;
if (years < 10) {
if (salary < 1000) {
increase = 100;
} else if (salary < 2000) {
increase = 200;
} else {
increase = 300;
}
} //end top if
if (years > 10) {
if (salary < 1000) {
increase = 200;
} else if (salary < 2000) {
increase = 300;
} else {
increase = 400;
}
} //end top if
String output = "";
if (increase < 100) {
output = "fair";
} else if (increase < 200) {
output = "ok";
} else if (increase < 300) {
output = "good";
} else {
output = "excellent";
}
JOptionPane.showMessageDialog(null,
"Years Worked: " + years + "\n" + "Salary: " +
salary + "\n" + "Increment: " + increase +
"\n" + "\n" + "Increment amount " +
output);
return increase;
} //end checkIncrement
}
This is the new coding. But the value for increase & increment doesn't appear. Where got error?

Being doing since 1 nw still cannot finish. sigh