Question

Need help with this, in JAVA, using netbeans. A complete response will receive a positive comment...

Need help with this, in JAVA, using netbeans. A complete response will receive a positive comment and thumbs up! Thank you!

Create a class schoolWorkers, that contains member variables for the employee name and salary. The schoolWorkers class should contain member methods for returning the employee name and salary. Create Faculty and Staff classes that inherit the schoolWorkers class. The Faculty class should include members for storing and returning the department name. The Staff class should include members for storing and returning the job title. Write a runner program that creates one instance of each class and prints all of the data for each object.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// SchoolWorkers.java
public class SchoolWorkers {
  
public String empName;
public double empSalary;
  
// returning method
public String getEmpName() {
return empName;
}

public double getEmpSalary() {
return empSalary;
}   
}

/* Faculty.java */


public class Faculty extends SchoolWorkers{
private String depName;

public String getDepName() { //returning method
return depName;
}

public void setDepName(String depName) { // storing method
this.depName = depName;
}
  
}
/* Staff.java */

public class Staff extends SchoolWorkers {
private String jobTitle;

public String getJobTitle() { // returning method
return jobTitle;
}

public void setJobTitle(String jobTitle) { // storing method
this.jobTitle = jobTitle;
}
   
}

/* Runner.java */ // To make working program

public class Runner { // Test class
public static void main(String[] args) {
// SchoolWorkers instance
SchoolWorkers schoolWorkers = new SchoolWorkers();
schoolWorkers.empName = "Harry";
schoolWorkers.empSalary = 2000.45;
  
// Faculty class instance
Faculty faculty = new Faculty();
faculty.setDepName("Computer");
  
// Staff class instance
Staff staff = new Staff();
staff.setJobTitle("Assistant");
  
// Print data of each instance
System.out.println("Employe Name: "+schoolWorkers.getEmpName() + " Salary: "+schoolWorkers.getEmpSalary());
System.out.println("Faculty Department: "+faculty.getDepName());
System.out.println("Staff Job Title: "+staff.getJobTitle());
}
    
}


/* OUTPUT */

/* PLEASE UPVOTE */

Add a comment
Know the answer?
Add Answer to:
Need help with this, in JAVA, using netbeans. A complete response will receive a positive comment...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • help please Perform the following steps: a) Using NetBeans, Create a New Java Application Project with...

    help please Perform the following steps: a) Using NetBeans, Create a New Java Application Project with Project Name BasePlusCommission Employee Test with Create Main Class check box selected. Create comments to form a descriptive header that has the course name, your name, the assignment title, and a pledge that you have neither received nor provided help to any person. Assignments submitted without this pledge will not be graded. When you have completed the steps (b) and (c) below, you will...

  • Design a class named Person and its two derived classes named Student and Employee. MakeFaculty and Staff derived classes of Employee

    In Java(The Person, Student, Employee, Faculty, and Staff classes)Design a class named Person and its two derived classes named Student and Employee. MakeFaculty and Staff derived classes of Employee. A person has a name, address, phone number, and e-mail address. A student has a class status (freshman, sophomore, junior, or senior). An employee has an office, salary, and date hired. Define a class namedMyDate that contains the fields year, month, and day. A faculty member has office hours and a rank....

  • a c++ program (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person...

    a c++ program (The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and email address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, and date hired. Use the MyDate classto create an object for date hired. A faculty...

  • In Python a class can inherit from more than one class (Java does not allow this)....

    In Python a class can inherit from more than one class (Java does not allow this). The resulting class will have all the methods and attributes from the parent classes. Do the following: • Create a class called Person. In the class, define variables for storing date of birth, place of birth, and male/female attributes. In the class, define the constructor method, as well as methods for returning current values of the class attributes. • Create a class called Employee....

  • Please send me this answer using netbeans in java programming with sample output in caption shown...

    Please send me this answer using netbeans in java programming with sample output in caption shown in picture Implement a super class Person. Make two classes, Student and instructor, inherit from Person. A person has a name and a year of birth. A student has a major and an instructor has a salary. Write the class definitions, the constructors, and the methods toString for all classes. Supply a test program that test these classes and methods C: WINNT System321cmd.exe Student...

  • Part I: (The Myate class) Design a class named MyDate. The class contains: • The data...

    Part I: (The Myate class) Design a class named MyDate. The class contains: • The data fields year, month, and day that represent a date. Month is 0-based, i.e., 0 is for January. • A no-arg constructor that creates a MyDate object for the current date. • A constructor that constructs a MyDate object with a specified elapsed time since midnight, January 1, 1970, in milliseconds. • A constructor hat constructs a MyDate object with the specified year, month, and...

  • Create a date class with attributes of month, day, and year. Create an employee class for...

    Create a date class with attributes of month, day, and year. Create an employee class for storing information related to employee information for the CS1C Corporation. This class should contain the employee’s name, employee’s Id, phone number, age, gender, job title, salary, and hire date. You should write a series of member functions that change the employee’s name, employee’s Id, phone number, age, job title, salary, and hire date. You should use your date class (composition) when accessing hire date....

  • In this laboratory, we are going to build a base class and a collection of derived...

    In this laboratory, we are going to build a base class and a collection of derived classes. Write the code to implement the class Person. A person has a name, address,telephone number and and E-Mail address. Be sure to include accessor functions to return each of these values. Create a derived class Student which has a class status (freshman, sophomore, junior, or senior). Create a derived class Employee which has the attributes office, salary, and date hired. Now define a...

  • Concepts Tested in this Program: Class Design Constructors Objects Inheritance Program:   Design a class named Person...

    Concepts Tested in this Program: Class Design Constructors Objects Inheritance Program:   Design a class named Person and its two subclasses, Student and Employee. Make Faculty and Staff subclasses of Employee. A Person object has a name, address, phone number, and email address (all Strings). A Student Object has a class status (freshman, sophomore, junior, or senior). Define the status as a final String variable. An Employee Object has an office number, salary (both ints ), and a date hired. Use...

  • Please answer all the questions 2. Design two programs named BaseClass and SubClass. In BaseClass, define...

    Please answer all the questions 2. Design two programs named BaseClass and SubClass. In BaseClass, define a variable xVar (type: char, value: 65), and a method myPrint to print xVar. SubClass is a subclass of BaseClass. In SubClass, define a variable yVar (type: int, value: 16) and another variable strVar (type: String, value: "java program!"). There is also a method myPrint to print the value of yVar and strVar in SubClass, as well as an additional method printAll, in which...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT