Question

In: Computer Science

USE JAVA Develop the classes for the following requirements: 1. A class named Employee (general, for...

USE JAVA

Develop the classes for the following requirements:

1. A class named Employee (general, for college)

2. A class named Instructor (more specific, for college)

3. A class named Staff (more specific, for college, HR officer, Marking staff)

Tasks:

1. Figure out the relationships among the classes;

2. Determine the abstract class, and the child classes;

3. For the abstract class, determine at least one abstract method;

4. Each class should at least two data members and one extra method;

5. Full implementation of all constructors, getters/setters and toString, and other methods;

6. Test your Java code and take screen shots

Solutions

Expert Solution

code:

package assignment;

abstract class Employee{ //abstract class
   public String general;
   public String college;
   public Employee(String general,String college) { //constructor
       this.general=general;
       this.college=college;
   }

}
abstract class Instructor extends Employee{ // child class of abstract class
   public String specific;
   public Instructor(String general, String college, String specific) {
       super(general, college);
       this.specific=specific;
   }
   public abstract void start();//abstract methods

}
class Staff extends Instructor{
   public String HR;
   public Staff(String general, String college, String specific, String HR) {
       super(general, college, specific);
       this.HR=HR;
   }
   @Override
   public void start() {
       System.out.println(this.college);
   }  
   public void setgeneral(String general) {
       this.general=general;
   }
   public String getgeneral() {
       return this.general;
   }
   public void setcollege(String college) {
       this.college=college;
   }
   public String getcollege() {
       return this.college;
   }
   public void setspecific(String specific) {
       this.specific=specific;
   }
   public String getspecific() {
       return this.specific;
   }
   public void setHR(String HR) {
       this.HR=HR;
   }
   public String getHR() {
       return this.HR;
   }
   public String toString()
   {
   return this.general +" " + this.college + " "+this.specific+ " " + this.HR;
   }

  
  
}

public class Cons {
   public static void main(String args[]) {
       Staff s=new Staff("general","college","specific","HR");
       System.out.println(s);
   }

}

Note:***I hope your happy with my answer***If you have any doubt please comment me****Thank you......


Related Solutions

use eclipse Develop the classes for the following requirements: 1. A class named Employee (general, for...
use eclipse Develop the classes for the following requirements: 1. A class named Employee (general, for college) 2. A class named Instructor (more specific, for college) 3. A class named Staff (more specific, for college, HR officer, Marking staff) Tasks: 1. Figure out the relationships among the classes; 2. Determine the abstract class, and the child classes; 3. For the abstract class, determine at least one abstract method; 4. Each class should at least two data members and one extra...
JAVA Design a class named Person and its two derived classes named Student and Employee. Make...
JAVA Design a class named Person and its two derived classes named Student and Employee. Make Faculty 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 datehired. Define a class named MyDate that contains the fields year, month, and day. A faculty member has office hours and a rank. A staff member has a...
Design a class named Employee. The class should keep the following information in fields: ·         Employee...
Design a class named Employee. The class should keep the following information in fields: ·         Employee name ·         Employee number in the format XXX–L, where each X is a digit within the range 0–9 and the L is a letter within the range A–M. ·         Hire date Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named ProductionWorker that inherits from the Employee class. The ProductionWorker class should have fields...
Design a class named Employee. The class should keep the following information in fields: ·         Employee...
Design a class named Employee. The class should keep the following information in fields: ·         Employee name ·         Employee number in the format XXX–L, where each X is a digit within the range 0–9 and the L is a letter within the range A–M. ·         Hire date Write one or more constructors and the appropriate accessor and mutator methods for the class. Next, write a class named ProductionWorker that inherits from the Employee class. The ProductionWorker class should have fields...
Java Question Design a class named Person and its two subclasses named Student and Employee. Make...
Java Question 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 Date class to create an object for date hired. A faculty member has office hours and a rank. A...
IN JAVA PLEASE, USE COMMENTS Following the example of Circle class, design a class named Rectangle...
IN JAVA PLEASE, USE COMMENTS Following the example of Circle class, design a class named Rectangle to represent a rectangle. The class contains: • Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height. • A no-arg constructor that creates a default rectangle. • A constructor that creates a rectangle with specified width and height • A method name getWidth() return the value...
THIS IS JAVA PROGRAMMING 1. Create a class named Name that contains the following: • A...
THIS IS JAVA PROGRAMMING 1. Create a class named Name that contains the following: • A private String to represent the first name. • A private String to represent the last name. • A public constructor that accepts two values and assigns them to the above properties. • Public methods named getProperty (e.g. getFirstName) to return the value of the property. • Public methods named setProperty ( e.g. setFirstName)to assign values to each property by using a single argument passed...
Write a java program with the following classes: Class Player Method Explanation: play : will use...
Write a java program with the following classes: Class Player Method Explanation: play : will use a loop to generate a series of random numbers and add them to a total, which will be assigned to the variable score. decideRank: will set the instance variable rank to “Level 1”, “Level 2”, “Level 3”, “Level 4” based on the value of score, and return that string. getScore : will return score. toString: will return a string of name, score and rank....
This is in JAVA Bank Accounts 01: Child Classes Copy the following SimpleBankAccount class and use...
This is in JAVA Bank Accounts 01: Child Classes Copy the following SimpleBankAccount class and use it as a base class: /** * Simple representation of a bank account * * @author Jo Belle * @version 0.5 (10/12/2020) */ import java.text.NumberFormat; public class SimpleBankAccount{ // fields (instance variables) private double balance; private String accountId; /** * Constructor for objects of class SimpleBankAccount */ public SimpleBankAccount(){ balance = 0.0; accountId = ""; } /** * Constructor for objects of class SimpleBankAccount...
This is in JAVA Bank Accounts 01: Child Classes Copy the following SimpleBankAccount class and use...
This is in JAVA Bank Accounts 01: Child Classes Copy the following SimpleBankAccount class and use it as a base class: /** * Simple representation of a bank account * * @author Jo Belle * @version 0.5 (10/12/2020) */ import java.text.NumberFormat; public class SimpleBankAccount{ // fields (instance variables) private double balance; private String accountId; /** * Constructor for objects of class SimpleBankAccount */ public SimpleBankAccount(){ balance = 0.0; accountId = ""; } /** * Constructor for objects of class SimpleBankAccount...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT