here are a couple of questions i tried doing but not sure if they are correct. if anyone could please help with with them that would be great.. thanks
An Employee will have a name, social security number, position, and hourly wages. Define the instance data for this class
Answer:
employeeName=na me;
employeePositio n=position;
hourlyWage=wage ;
socialSecurityN umber=ssn;
Write a method that is passed the int value of the number of hours worked for the week as a parameter, and returns the pay for the Employee (including overtime, which is 1.5 * hourly wages for each hour over 40).
Answer:
public double pay (double hours)
{
if(hours<=40)
pay=hours*wage;
else
pay=1.5*wage*ho urs;
return pay;
}
Write a raise method that is passed an increase (or decrease) in hourly wages and updates the Employee’s hourly wages appropriately. The amount passed is strictly the amount of increase or decrease, not a new hourly wage. If the amount of increase (or decrease) is too much (more than what the Employee currently makes) do not adjust the hourly wage, but instead output a warning message.
Answer:// this one im not sure about
public rasie(double increase, double decrease)
{
if(decrease<=Ma th.abs(wage))
System.out.prin tln("Warning amount is less than what employee makes");
else
raise=increase+ wage;
}
An Employee will have a name, social security number, position, and hourly wages. Define the instance data for this class
Answer:
employeeName=na me;
employeePositio n=position;
hourlyWage=wage ;
socialSecurityN umber=ssn;
Write a method that is passed the int value of the number of hours worked for the week as a parameter, and returns the pay for the Employee (including overtime, which is 1.5 * hourly wages for each hour over 40).
Answer:
public double pay (double hours)
{
if(hours<=40)
pay=hours*wage;
else
pay=1.5*wage*ho urs;
return pay;
}
Write a raise method that is passed an increase (or decrease) in hourly wages and updates the Employee’s hourly wages appropriately. The amount passed is strictly the amount of increase or decrease, not a new hourly wage. If the amount of increase (or decrease) is too much (more than what the Employee currently makes) do not adjust the hourly wage, but instead output a warning message.
Answer:// this one im not sure about
public rasie(double increase, double decrease)
{
if(decrease<=Ma th.abs(wage))
System.out.prin tln("Warning amount is less than what employee makes");
else
raise=increase+ wage;
}
Comment