I am new to java and I keep getting this error message:
No enclosing instance of type Managesalary is accessible. Must qualify the allocation with an enclosing instance of type Managesalary (e.g. x.new A() where x is an instance of Managesalary). on line *
public class Managesalary
{
public static void main(String[] args)
{
System.out.println("MY SALARY REVIEW");
System.out.println("================");
* Salary Jan= new Salary();
Jan.Month= "JANUARY";
Jan.HoursWorked= 12;
Jan.PerHourRate= 10;
Jan.TaxRate= 0.10;
Jan.printSalaryDetails();
Salary Month2= new Salary();
Month2.Month= "FEBUARY";
Month2.PerHourRate= 10;
Month2.TaxRate= 0.10;
Month2.printSalaryDetails();
}
class Salary
{
String Month = "";
int HoursWorked= 0;
int PerHourRate= 0;
double TaxRate= 0.10;
int MonthlySalary= (HoursWorked*PerHourRate);
public void printSalaryDetails(){
System.out.println("MONTH OF = " +Month);
System.out.println("PER HOUR RATE = " +PerHourRate);
System.out.println("TAX RATE = " +TaxRate);
System.out.println("TOTAL MONTHLY INCOME = " +MonthlySalary);
System.out.println("================");
}
}
}