Can some help me with this. Please review this code for errors. I can not get it to complie.
Here is my Code .. This is an abstract class that is used in conjuntion with 4 other classes.. They are Hourly, IAm, Salaried, Sales.
import java.util.*;
//Constructors
//Constructor
public abstract class Employee
extends java.lang.Object{
private int empID, zip;
private String lastName, firstName, address;
public abstract double getPay(); //Abstract Methods
public Employee(int empID, java.lang.String lastName,
java.lang.String firstName,
java.util.GregorianCalendar hireDate,
java.lang.String address, int zip) {
this(empID, lastName, firstName, hireDate,
address, zip, null);
}
public Employee(int empID, java.lang.String lastName,
java.lang.String firstName,
java.util.GregorianCalendar hireDate,
java.lang.String address, int zip,
java.util.GregorianCalendar termDate) {
setEmployeeID(empID);
setLastName(lastName);
setFirstName(firstName);
setHireDate(hireDate);
setAddress(address);
setZip(zip);
setTermDate(termDate);
}
public final void setAddress(String address) {
this.address = address;
} //set address
public String getAddress() {
return address;
} //get address
public void setEmployeeID(int empID) {
this.empID = empID;
} //set EmployeeID
public int getEmployeeID() {
return empID;
} //get EmployeeID
public void setLastName(java.lang.String lastName) {
this.lastName = lastName;
} //set lastName
public java.lang.String getLastName() {
return lastName;
} //getLastName
public void setFirstName(java.lang.String firstName) {
this.firstName = firstName;
} //setFirstName
public java.lang.String getFirstName() {
return firstName;
} //getFirstName
//sets fullname to firstName+lastName
public final java.lang.String getFullName() {
this.fullName = firstName + lastName;
} //gets employee's full name
public java.lang.String getFullName() {
return FullName = firstName() + lastName();
} // returns fullname as firstname + lastname
public final void setHireDate(java.util.GregorianCalendar hireDate) {
this.hireDate = hireDate;
} //sets hiredate of employee
public final java.util.GregorianCalendar getHireDate() {
return hireDate = hiredate;
} //returns hireDate of employee
public final java.util.GregorianCalendar getTermDate() {
return termDate = termdate;
} //get's employee's termination date
public final void setTermDate(java.util.GregorianCalendar termDate) {
this.setTermDate(termDate);
} //sets employee's termination date
public void setZip(int Zip) {
this.setZip(Zip);
} //setZip Code
public int getZip() {
return zip = zip;
} //returns employee's zip Code
public java.lang.String getCity() {
return city = city;
} //returns employee's city
public final java.lang.String getState() {
return state = state;
} //returns employee's state
public final java.lang.String getCityState() {
return getCityState = City() + State();
} //getCityState returns the employee's city and state based on zipcode
//the employee's city and state as "City,State"
public java.lang.String toString() { //returns the employee's sorted name as LastName, FirstName
} //toString overides in class java.lang.Object
//returns the employees full name -- example "Smith,Sue"
protected boolean isPaid(){// isPaid determines if the employee is paid or not.
}//returns a true if the employee is paid : false if the employee is not paid
//if termination date is null, return true.. if termination date is not null then
//return false. use method getTermDate()
public static java.lang.String getProgrammer(){// getProgrammer returns the name of the Programmer
}//returns my name from the method getName in the IAm Class of this Project.
}
3 3866
Can some help me with this. Please review this code for errors. I can not get it to complie.
Here is my Code .. This is an abstract class that is used in conjuntion with 4 other classes.. They are Hourly, IAm, Salaried, Sales.
import java.util.*;
//Constructors
//Constructor
public abstract class Employee
extends java.lang.Object{
private int empID, zip;
private String lastName, firstName, address;
public abstract double getPay(); //Abstract Methods
public Employee(int empID, java.lang.String lastName,
java.lang.String firstName,
java.util.GregorianCalendar hireDate,
java.lang.String address, int zip) {
this(empID, lastName, firstName, hireDate,
address, zip, null);
}
public Employee(int empID, java.lang.String lastName,
java.lang.String firstName,
java.util.GregorianCalendar hireDate,
java.lang.String address, int zip,
java.util.GregorianCalendar termDate) {
setEmployeeID(empID);
setLastName(lastName);
setFirstName(firstName);
setHireDate(hireDate);
setAddress(address);
setZip(zip);
setTermDate(termDate);
}
public final void setAddress(String address) {
this.address = address;
} //set address
public String getAddress() {
return address;
} //get address
public void setEmployeeID(int empID) {
this.empID = empID;
} //set EmployeeID
public int getEmployeeID() {
return empID;
} //get EmployeeID
public void setLastName(java.lang.String lastName) {
this.lastName = lastName;
} //set lastName
public java.lang.String getLastName() {
return lastName;
} //getLastName
public void setFirstName(java.lang.String firstName) {
this.firstName = firstName;
} //setFirstName
public java.lang.String getFirstName() {
return firstName;
} //getFirstName
//sets fullname to firstName+lastName
public final java.lang.String getFullName() {
this.fullName = firstName + lastName;
} //gets employee's full name
public java.lang.String getFullName() {
return FullName = firstName() + lastName();
} // returns fullname as firstname + lastname
public final void setHireDate(java.util.GregorianCalendar hireDate) {
this.hireDate = hireDate;
} //sets hiredate of employee
public final java.util.GregorianCalendar getHireDate() {
return hireDate = hiredate;
} //returns hireDate of employee
public final java.util.GregorianCalendar getTermDate() {
return termDate = termdate;
} //get's employee's termination date
public final void setTermDate(java.util.GregorianCalendar termDate) {
this.setTermDate(termDate);
} //sets employee's termination date
public void setZip(int Zip) {
this.setZip(Zip);
} //setZip Code
public int getZip() {
return zip = zip;
} //returns employee's zip Code
public java.lang.String getCity() {
return city = city;
} //returns employee's city
public final java.lang.String getState() {
return state = state;
} //returns employee's state
public final java.lang.String getCityState() {
return getCityState = City() + State();
} //getCityState returns the employee's city and state based on zipcode
//the employee's city and state as "City,State"
public java.lang.String toString() { //returns the employee's sorted name as LastName, FirstName
} //toString overides in class java.lang.Object
//returns the employees full name -- example "Smith,Sue"
protected boolean isPaid(){// isPaid determines if the employee is paid or not.
}//returns a true if the employee is paid : false if the employee is not paid
//if termination date is null, return true.. if termination date is not null then
//return false. use method getTermDate()
public static java.lang.String getProgrammer(){// getProgrammer returns the name of the Programmer
}//returns my name from the method getName in the IAm Class of this Project.
}
The code looks very bad. I think you should revisit the tutorials on methods and classes before you continue. I have made it compile but it is still very bad. Also read the tutorials on how to use import statements. - import java.util.*;
-
//Constructors
-
//Constructor
-
public abstract class Employee
-
extends java.lang.Object{
-
private int empID, zip;
-
private String lastName, firstName, address, fullName, city, state;
-
java.util.GregorianCalendar hireDate;
-
java.util.GregorianCalendar termDate;
-
-
public abstract double getPay(); //Abstract Methods
-
public Employee(int empID, java.lang.String lastName,
-
java.lang.String firstName,
-
java.util.GregorianCalendar hireDate,
-
java.lang.String address, int zip) {
-
this(empID, lastName, firstName, hireDate,
-
address, zip, null);
-
}
-
public Employee(int empID, java.lang.String lastName,
-
java.lang.String firstName,
-
java.util.GregorianCalendar hireDate,
-
java.lang.String address, int zip,
-
java.util.GregorianCalendar termDate) {
-
setEmployeeID(empID);
-
setLastName(lastName);
-
setFirstName(firstName);
-
setHireDate(hireDate);
-
setAddress(address);
-
setZip(zip);
-
setTermDate(termDate);
-
}
-
public final void setAddress(String address) {
-
this.address = address;
-
} //set address
-
public String getAddress() {
-
return address;
-
} //get address
-
public void setEmployeeID(int empID) {
-
this.empID = empID;
-
} //set EmployeeID
-
public int getEmployeeID() {
-
return empID;
-
} //get EmployeeID
-
public void setLastName(java.lang.String lastName) {
-
this.lastName = lastName;
-
} //set lastName
-
public java.lang.String getLastName() {
-
return lastName;
-
} //getLastName
-
public void setFirstName(java.lang.String firstName) {
-
this.firstName = firstName;
-
} //setFirstName
-
public java.lang.String getFirstName() {
-
return firstName;
-
} //getFirstName
-
//sets fullname to firstName+lastName
-
public final void setFullName(String firstName, String lastName) {
-
this.fullName = firstName + lastName;
-
} //gets employee's full name
-
public java.lang.String getFullName() {
-
return fullName;
-
} // returns fullname as firstname + lastname
-
public final void setHireDate(java.util.GregorianCalendar hireDate) {
-
this.hireDate = hireDate;
-
} //sets hiredate of employee
-
public final java.util.GregorianCalendar getHireDate() {
-
return hireDate = hireDate;
-
} //returns hireDate of employee
-
public final java.util.GregorianCalendar getTermDate() {
-
return termDate;
-
} //get's employee's termination date
-
public final void setTermDate(java.util.GregorianCalendar termDate) {
-
this.termDate = termDate;
-
} //sets employee's termination date
-
public void setZip(int Zip) {
-
this.setZip(Zip);
-
} //setZip Code
-
public int getZip() {
-
return zip = zip;
-
} //returns employee's zip Code
-
public java.lang.String getCity() {
-
return this.city;
-
} //returns employee's city
-
public final java.lang.String getState() {
-
return state;
-
} //returns employee's state
-
public final java.lang.String getCityState() {
-
return city + state;
-
} //getCityState returns the employee's city and state based on zipcode
-
//the employee's city and state as "City,State"
-
//public java.lang.String toString() { //returns the employee's sorted name as LastName, FirstName
-
//} //toString overides in class java.lang.Object
-
//returns the employees full name -- example "Smith,Sue"
-
//protected boolean isPaid(){// isPaid determines if the employee is paid or not.
-
//}//returns a true if the employee is paid : false if the employee is not paid
-
//if termination date is null, return true.. if termination date is not null then
-
//return false. use method getTermDate()
-
//public static java.lang.String getProgrammer(){// getProgrammer returns the name of the Programmer
-
//}//returns my name from the method getName in the IAm Class of this Project.
-
}
-
-
Thanks I will try the revisions tonight. one of my problems is that the teacher i have runs very fast. Here says and add this and then this and this and then this and then complie and oh at this and fix this and fix this and then compile and then add this and then complile and oh fix this error and now done. ok now fix this example. We are going can you slow that down a bit... That is why I am here. You guys are teaching me more. Most of the code you see is from his handout. java.lang.util and the messy stuff we have not done. but it is in this exercise.
Thanks any help you can give to help me understand this is great.
John
If someone knows some dazzle code for this I sure would like to see it. Sorry for all the comments.. Just wanted you to have as much information as I do.
Thanks
john
Post your reply Sign in to post your reply or Sign up for a free account.
Similar topics
16 posts
views
Thread by Merlin |
last post: by
|
11 posts
views
Thread by Shea Martin |
last post: by
|
6 posts
views
Thread by Dan Sikorsky |
last post: by
|
10 posts
views
Thread by Joe |
last post: by
|
17 posts
views
Thread by RSH |
last post: by
|
12 posts
views
Thread by scottt |
last post: by
|
4 posts
views
Thread by N.RATNAKAR |
last post: by
|
reply
views
Thread by emin.shopper |
last post: by
|
4 posts
views
Thread by Devon Null |
last post: by
| | | | | | | | | | |