troubleshooting Question

Output error

Avatar of waltbaby315
waltbaby315 asked on
Java
11 Comments1 Solution306 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
Mick Barry
Java Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Top Expert 2010

The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros