Question: Hello. I need some help troubleshooting my program. I am having trouble combining my classes: address, employee name and date. I need to connect them,

Hello. I need some help troubleshooting my program. I am having trouble combining my classes: address, employee name and date. I need to connect them, so that I will be able to attach my subclasses to this program. With just the name class, I was able to effectively run my program, but I was unable to run my program with the addition of the address and date classes. Thank you.

class EmployeeClassName {

//get and return firstName, lastName, and employeeNumber

private String firstName;

private String lastName;

private int employeeNumber;

public String getFirstName()

{

return firstName;

}

public String getLastName()

{

return lastName;

}

public int getEmployeeNumber()

{

return employeeNumber;

}

public EmployeeClassName (String fn, String ln, int en)

{

firstName = fn;

lastName = ln;

employeeNumber = en;

}

}

//address class

class address{

String street;

String city;

String state;

String zipcode;

// constructor of class

public address(String street, String city, String state, String zipcode) {

super();

this.street = street;

this.city = city;

this.state = state;

this.zipcode = zipcode;

}

// get and return street

public String getStreet() {

return street;

}

public String getCity() {

return city;

}

public String getState() {

return state;

}

public String getZipcode() {

return zipcode;

}

}

// date class

class date{

int month;

int day;

int year;

// get and return month

public int getMonth() {

return month;

}

public int getDay() {

return day;

}

public int getYear() {

return year;

}

class Employee {

public void main (String args []) {

Employee( String fn, String ln, String en, String street, String city, String state, String zipcode, int month, int day, int year )

{

SalariedEmployee employee1 = new SalariedEmployee("Suzie", "Palmer", 135 Pheasant Run, Argyle, TX, 76226, 12005, 126000);

System.out.println(employee1.getFirstName() + "\t" + employee1.getLastName() + "\t" + employee1.address.getStreet() + " " + employee1.address.getCity() + " " + employee1.address.getState() + " " + employee1.address.getZipcode() + "\t" + employee1.date.getMonth() + "/" + employee1.date.getDay() + "/" + employee1.date.getYear() + employee1.getEmployeeNumber() + "\t" +employee1.annualSalary);

}

}}

class SalariedEmployee extends Employee {

double annualSalary;

SalariedEmployee(String fn, String ln, String street, String city, String state, String zipcode, int month, int day, int year, int en, double as);

{

super(fn, ln, street, city, state, zipcode, month, day, year, en);

annualSalary = as;

}

}

//these are my two classes

class HourlyEmployee extends Employee {

double hourlyPayRate;

double hoursWorked;

double earnings;

HourlyEmployee(String fn, String ln, int en,String street, String city, String state, String zipcode, int month, int day, int year, double hpr, double hw, double e)

{

super(fn, ln, street, city, state, zipcode, month, day, year, en);

hourlyPayRate = hpr;

hoursWorked = hw;

earnings = e;

}

double getEarnings ()

{

if (hoursWorked >40 )

{

earnings = hourlyPayRate * 1.5 * hoursWorked;

}

else

{

earnings = hourlyPayRate * hoursWorked;

}

return earnings;

}

}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!