hi
I m working on this assignment...base class employee sub class staff .now i have to Create a StaffDriver Java program that:
a. creates two staff objects
b. prompts the user to enter name, id, hours and rate
for each object
c. compute the pay for each object
d. displays employee information
please help me so far i have this code....
thanks
import java.io.IOException;
public class employee {
private String Name;
private int Id;
public static void main (String args[]) throws IOException {
//BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//System.out.println("Please input a name and press Enter ");
//String Name = in.readLine();
//System.out.println("Please input an Id and press Enter ");
//Integer Id = Integer.parseInt(in.readLine());
//System.out.println("You entered " + Name + " id: " + Id);
}
public employee()
{
setName("Any Employees");
Id = 9999;
}
public void GetEmployee( String NameIn,int IdIn )
{
setName(NameIn);
Id = IdIn;
}
public void setName(String name) {
Name = name;
}
public String getName() {
return Name;
}
public void ShowEmployee()
{
System.out.println( getName() + " " + Id);
}
public void ZapEmployee()
{
System.out.println( getName() + " No Longer works here");
setName("Former Employee");
Id = 9999;
}
}
public class Staff extends employee
{
private double Hours;
private double Rate;
private double Pay;
public Staff()
{
Hours = 0;
Rate = 0;
Pay = 0;
}
public void GetEmployee(String NameIn, int IdIn, double HoursIn, double RateIn)
{
super.GetEmployee(NameIn, IdIn);
Hours = HoursIn;
Rate = RateIn;
}
public void ShowEmployee()
{
super.ShowEmployee();
System.out.println( Pay + " ");
}
public void ComputePay()
{
if (Hours > 40)
{
Pay = (40 * Rate) + ((Hours - 40)* (1.5 * Rate));
}
else
{
Pay = Hours * Rate;
}
System.out.println(getName() + " " + Pay);
}
}