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 4049
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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?)...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: N.RATNAKAR |
last post by:
hai,
what is abstract class and abstract method
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |