Avatar of waltbaby315
waltbaby315

asked on 

Output error

Can someone help me figure out this error?

class Employee1
{
    private int age;
    private int id;
    private int salary;
   
    private String name;
    private String position;
   
    public Employee1(String name, int id, int salary, int age, String position)
    {
        this.name = name;
        this.id = id;
        this.salary = salary;
        this.age = age;
        this.position = position;
    }
   
    public int getFedTax()
    {
        return (int)((salary-800)*0.17);
    }
   
    public int getSsTax(int rate)
    {
         
        return (int)((rate/100)/salary);
         
    }
   
    public int getHealthFee(int rate)
    {
         
        return (int)((rate/100)/salary);
         
    }
   
    public int getInsurance()
    {
       
        if (salary<40)
            return (int)(salary*0.03);
        if (salary<50)
            return (int)(salary*0.04);
        if (salary<60)
            return (int)(salary*0.05);
        else
            return (int)(salary*0.06);
    }
   
    public double getNetPay()
    {
         
        return salary-getFedTax()-getSsTax(1)-getHealthFee(3)-getInsurance();
    }
}


class Employee1
{
    public static void main (String [] args)
    {
        Employee Fred = new Employee("Freddy", 1, 1000000, 22, "Garbage sanitisor");
        Employee Sarah = new Employee("Sarah", 1, 500000, 46, "<<Insert humorous profession name>>");
        System.out.println("Fred's Fex tax is: " + Fred.getFedTax());
        System.out.println("Fred's SS tax (rate of 1%) is: " + Fred.getSsTax(1));
        System.out.println("Fred's Health fee (rate of 3%) is: " + Fred.getHealthFee(3));
        System.out.println("Fred's insurance cost is: " + Fred.getInsurance());
        System.out.println("Fred's net pay is: " + Fred.getNetPay());
        System.out.println("---------------------------");
        System.out.println("Sarah's Fex tax is: " + Sarah.getFedTax());
        System.out.println("Sarah's SS tax (rate of 1%) is: " + Sarah.getSsTax(1));
        System.out.println("Sarah's Health fee (rate of 3%) is: " + Sarah.getHealthFee(3));
        System.out.println("Sarah's insurance cost is: " + Sarah.getInsurance());
        System.out.println("Sarah's net pay is: " + Sarah.getNetPay());
    }
}
16-May.JPG
Java

Avatar of undefined
Last Comment
Ajay-Singh

8/22/2022 - Mon