We help IT Professionals succeed at work.
Get Started

Output error

waltbaby315
waltbaby315 asked
on
304 Views
Last Modified: 2013-11-23
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
Comment
Watch Question
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE