The Artima Developer Community
Sponsored Link

Java Answers Forum
help to resolve errors

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
barobi

Posts: 3
Nickname: lethabile
Registered: Feb, 2003

help to resolve errors Posted: Feb 8, 2003 2:19 PM
Reply to this message Reply
Advertisement
program should describe the characteristics of the employees of a company. This class should contain the name (first and last name), omang, address, etc of the employee, together with pay information. Given that this company has two different types of employees, those on a salary and those paid by the hour. Create two subclasses of Employee: SalariedEmployee and HourlyEmployee, with different methods for calculating monthly pay and for displaying an employee details. Both of these subclasses should inherit all of the common information and methods from Employee, but should override the methods used to calculate pay and to display employee details. here is the program
}import java.util.*

class Employee
{
string firstname;
string lastname;
int omang;
int pay;

public Employee()
{

Employee(string first,string last, int id)
{

fisrtname=first;
lastname=last
omang=id;
}
}
void calspay(480)
{

pay=480;

}
string tostring
return("firstname","lastname","omang");
}

}







public class SalairedEmployee extends employee

{

int salary;

SalariedEmployee()
{
SalariedEmployee(string first,string last ,int id int sal)

{

super(first,last,id)

salary=sal;

pay=salary;

}

public void setsalary(int sal)

{

this.sal=salary;

}

private string formatDate(calender cal)

{

string[]month={"january","february","march","april","may","june","july ","august","september","october","november,"december");

string p=cal.pay(calender day)+"_";
string p+=month[cal.pay(calender.month)]+"_";
string p+=cal.pay(calender.year);

return p;
}


void calcpay(480)
{

pay=480;

}

string tostring();
return("firstname","lastname","omang":salary);
}
}








public class HourlyEmployee extents Employee

{

int=rate;

HourlyEmployee()

{

HourlyEmployee(string first,string last,int id,int rate)

{

super(first,last,id)

{


rate=ratee;
pay=0;

}

void setrate(ratee)

{

hourlyrate=ratee;

}

void calcpay(hourly)

{

int hourInday=24;

pay=480/24

}


string tostring()
return("firstname","lastname","omang":pay);

}

}

Topic: help, i need to know how ACM last year coded this problem!! Previous Topic   Next Topic Topic: Code for converting binary to hexidecimal

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use