
Write a java program that has:
A class University that has:
- Three private instance variables named firstName, lastName, and id
- A constructor to initialize the three instance variables
- A toString method to return: “Welcome,” + firstName +” “ + lastName + “Your ID is ” + id
- Accessors
A subclass Employee that has:
- Five additional private instance variables named department, rate, bonus, hours, and salary
- An appropriate constructor to use constructor of superclass in defining those of the subclass
- A method named compteSalary ( ) to return salary
- A method named computeBonus ( ) to return bonus
- Accessors
A subclass Staff that:
- Overrides computeBonus ( ) such that if hours are greater than 40, there will be %10 bonus for each additional hour
added to salary
- Overrides compteSalary ( ) such that salary = (rate * hours) + bonus
- Overrides toString method to add department and salary into the output
A subclass Faculty that:
- Overrides computeBonus ( ) such that if hours are greater than 40, there will be %25 bonus for each additional hour
added to salary
- Overrides compteSalary ( ) such that salary = (rate * hours) + bonus
- Overrides toString method to add department and salary into the output
A subclass Student that has:
- Three additional private instance variables major, level, and grade
- An appropriate constructor to use constructor of superclass in defining those of the subclass
- One instance method computeGrade( ) to return the grade
- Overrides toString method to add major and level into the output
- Accessors
A subclass Undergrade that has:
- Three additional private instance variables named course1, course2, and course3 as double
- An appropriate constructor to use constructor of superclass in defining those of the subclass
- Overrides computeGade( ) such that grade = [(course1 + course2+ course3) / 300 ] * 100
- Overrides toString method to add grade into the output
- Accessors
A TestUniv class that has:
- The main function to run your code.
- Create objects to show two different outputs like:
Output 1:
Welcome, Ahmed Abdullah. Your ID is 123456
Your department is Computer Science and Engineering
Your salary for this month is 10,000

As per the given question, we need to create classes University, Employee, Staff, Faculty, Student, Undergrade, and TestUniv(This class tests the working of the remaining classes).
Attributes and methods of University class:
Attributes:
- firstName
- lastName
- id
Methods:
- Constructor
- Accessor methods i.e getter methods
- toString()
Attributes and methods of Employee class:
Attributes:
- firstName
- lastName
- id
- department
- rate
- bonus
- hours
- salary
Methods:
- Constructor
- Accessor methods i.e getter methods
- toString()
- compteSalary
- computeBonus
Attributes and methods of Staff class:
Attributes:
- firstName
- lastName
- id
- department
- rate
- bonus
- hours
- salary
Methods:
- Constructor
- toString()
- compteSalary
- computeBonus
Attributes and methods of Faculty class:
Attributes:
- firstName
- lastName
- id
- department
- rate
- bonus
- hours
- salary
Methods:
- Constructor
- toString()
- compteSalary
- computeBonus
Attributes and methods of Student class:
Attributes:
- firstName
- lastName
- id
- major
- level
- grade
Methods:
- Constructor
- toString()
- computeGrade
- Accessor methods
Attributes and methods of Undergrade class:
Attributes:
- firstName
- lastName
- id
- major
- level
- grade
- course1
- course2
- course3
Methods:
- Constructor
- toString()
- computeGrade
- Accessor methods
Step by stepSolved in 4 steps with 2 images

- The Essay class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare the following objects: essay1 with no arguments essay2 with essayTitle and essayAuthor as arguments essay3 with essayTitle, essayAuthor, and essayYear as arguments Ex: If the input is Painting Cole 1919, then the output is: Essay: Undefined, Unspecified, 0 Essay: Painting, Cole, 0 Essay: Painting, Cole, 1919 Archive.java public class Archive { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); StringessayTitle; StringessayAuthor; intessayYear; essayTitle=scnr.next(); essayAuthor=scnr.next(); essayYear=scnr.nextInt(); /* Your code goes here */ essay1.print(); essay2.print(); essay3.print(); } } Essay.java public class Essay { private String title; private String author; private int year; public Essay() { // Default constructor title = "Undefined"; author = "Unspecified"; year = 0; }…arrow_forwardCreate a Class called Transaction with: instance variables: stock - your stock class type - char -> b or s (buy/sell) quantity - can be fractional price - buy/sell price when - LocalDate constructors: constructor with parameters for stock, type and quantity. - sets the price from the stock price instance variable - sets when from LocalDate getters and setters for each instance variablearrow_forwardDesign a console program that will print details of DVDs available to buy. Make use of an abstract class DVD with variables that will store the title, yearReleased, running time and price of a DVD. Create a constructor that accepts the title, yearReleased and running time through parameters and assign these to the class variables. Create an abstract set method for the price of a DVD; also create get methods for the variables.Create a subclass InstructionalDVD that extends the DVD class and implements an iPrintable interface. The interface that must be added is shown below:public interface iPrintable { String ShowDetails();}The InstructionalDVD subclass has a private variable named category for which a get method must be written. The constructor of the InstructionalDVD class must accept the title, yearReleased, running time and category through parameters. Write the code for the setPrice() and ShowDetails() methods.Write a useDVD class and instantiate 2 objects of the InstructionalDVD…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





