473,414 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Employee Class abstract

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.
}
Nov 17 '06 #1
3 4049
r035198x
13,262 8TB
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.



Expand|Select|Wrap|Line Numbers
  1.  import java.util.*; 
  2. //Constructors
  3. //Constructor
  4. public abstract class Employee
  5. extends java.lang.Object{
  6. private int empID, zip;
  7. private String lastName, firstName, address, fullName, city, state;
  8. java.util.GregorianCalendar hireDate;
  9. java.util.GregorianCalendar termDate;
  10.  
  11. public abstract double getPay(); //Abstract Methods
  12. public Employee(int empID, java.lang.String lastName,
  13. java.lang.String firstName,
  14. java.util.GregorianCalendar hireDate,
  15. java.lang.String address, int zip) {
  16. this(empID, lastName, firstName, hireDate,
  17. address, zip, null);
  18. }
  19. public Employee(int empID, java.lang.String lastName,
  20. java.lang.String firstName,
  21. java.util.GregorianCalendar hireDate,
  22. java.lang.String address, int zip,
  23. java.util.GregorianCalendar termDate) {
  24. setEmployeeID(empID);
  25. setLastName(lastName);
  26. setFirstName(firstName);
  27. setHireDate(hireDate);
  28. setAddress(address);
  29. setZip(zip);
  30. setTermDate(termDate);
  31. }
  32. public final void setAddress(String address) {
  33. this.address = address;
  34. } //set address
  35. public String getAddress() {
  36. return address;
  37. } //get address
  38. public void setEmployeeID(int empID) {
  39. this.empID = empID;
  40. } //set EmployeeID
  41. public int getEmployeeID() {
  42. return empID;
  43. } //get EmployeeID
  44. public void setLastName(java.lang.String lastName) {
  45. this.lastName = lastName;
  46. } //set lastName
  47. public java.lang.String getLastName() {
  48. return lastName;
  49. } //getLastName
  50. public void setFirstName(java.lang.String firstName) {
  51. this.firstName = firstName;
  52. } //setFirstName
  53. public java.lang.String getFirstName() {
  54. return firstName;
  55. } //getFirstName
  56. //sets fullname to firstName+lastName
  57. public final void setFullName(String firstName, String lastName) {
  58. this.fullName = firstName + lastName;
  59. } //gets employee's full name
  60. public java.lang.String getFullName() {
  61. return fullName;
  62. } // returns fullname as firstname + lastname
  63. public final void setHireDate(java.util.GregorianCalendar hireDate) {
  64. this.hireDate = hireDate;
  65. } //sets hiredate of employee
  66. public final java.util.GregorianCalendar getHireDate() {
  67. return hireDate = hireDate;
  68. } //returns hireDate of employee
  69. public final java.util.GregorianCalendar getTermDate() {
  70. return termDate;
  71. } //get's employee's termination date
  72. public final void setTermDate(java.util.GregorianCalendar termDate) {
  73. this.termDate = termDate;
  74. } //sets employee's termination date
  75. public void setZip(int Zip) {
  76. this.setZip(Zip);
  77. } //setZip Code
  78. public int getZip() {
  79. return zip = zip;
  80. } //returns employee's zip Code
  81. public java.lang.String getCity() {
  82. return this.city;
  83. } //returns employee's city
  84. public final java.lang.String getState() {
  85. return state;
  86. } //returns employee's state
  87. public final java.lang.String getCityState() {
  88. return city + state;
  89. } //getCityState returns the employee's city and state based on zipcode
  90. //the employee's city and state as "City,State"
  91. //public java.lang.String toString() { //returns the employee's sorted name as LastName, FirstName
  92. //} //toString overides in class java.lang.Object
  93. //returns the employees full name -- example "Smith,Sue"
  94. //protected boolean isPaid(){// isPaid determines if the employee is paid or not.
  95. //}//returns a true if the employee is paid : false if the employee is not paid
  96. //if termination date is null, return true.. if termination date is not null then
  97. //return false. use method getTermDate()
  98. //public static java.lang.String getProgrammer(){// getProgrammer returns the name of the Programmer
  99. //}//returns my name from the method getName in the IAm Class of this Project.
  100. }
  101.  
  102.  
Nov 18 '06 #2
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
Nov 18 '06 #3
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
Nov 18 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Merlin | last post by:
Hi Been reading the GOF book and started to make the distinction between Class and Interface inheritance. One question though: Do pure abstract classes have representations? (data members?)...
11
by: Shea Martin | last post by:
I have been programming in C++ for over 4 years. I *think* I knew that a struct could have a constructor but I decided to dig into it a little more today, and found that there is very little...
6
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove...
10
by: Joe | last post by:
My question is more an OOD question. I know *how* to implement both abstract classes and interfaces. Here's my question - under what circumstacnes does one use an abstract class and under what...
17
by: RSH | last post by:
I am really trying to grasp the concept of OOP as it applies to C#. I am looking at trying to set up a simple Employee Class but I am having trouble conceptualizing what this class should look...
12
by: scottt | last post by:
hi, I am having a little problem passing in reference of my calling class (in my ..exe)into a DLL. Both programs are C# and what I am trying to do is pass a reference to my one class into a DLL...
4
by: N.RATNAKAR | last post by:
hai, what is abstract class and abstract method
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
4
by: Devon Null | last post by:
I have been exploring the concept of abstract classes and I was curious - If I do not define a base class as abstract, will it be instantiated (hope that is the right word) when a derived class is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.