In this project, you'll create a hierarchy of Java classes representing various types of employees in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this project, you'll create a hierarchy of Java classes representing various types of employees in at company (executive, manager, worker). Each different employee class will have its own.java source file, and will be derived from the base class Employee. For the root of the Employee class hierarchy, write a class named Employee that will be the base class of all the other Employee types. It should have two private String instance variables representing the employee's name and type, and a private double instance variable representing the employee's hourly payrate. The class should have the following public methods: public Employee (String type, String name) a constructor that sets the type and name instance values. public String getName()-this method returns the object's name value. public String getType()-this method returns the object's type value. public double get Payrate () this method returns the object's hourly payrate. It must be overridden in each class. For the base Employee class, this method retums 0.0. public double payCheck (this method computes and retums the object's weekly payCheck amount by multiplying their hourly rate (different for each type) by 40 hours. It must be overridden in each derived class. For the base Employee class, this method returns 0.6. public String toString(this method returns the object's description (name, type, payrate, and paycheck) as a String it must be overridden in each derived class. For the hase Empl nyer class this method returns the string "generic employee". Write a Executive class that extends Employee. It should have one private double instance variable representing the executive payrate of $50.00 per hour, and should have the following public methods: public Executive (String type, String name) - a constructor that invokes the base constructor (passing the type and name), then sets the payRate instance variable. public double get Payrate () this method returns the object's hourly payrate. public double payCheck (this overriding method computes and returns the Executive object's hourly payrate. public String toString( this overriding method retums the Executive object's description ((name, type, payrate, and paycheck). Write a Manager class that extends Employee. It should have one private double instance variabe representing the manager payrate of $35.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Write a Worker class that extends Employee. It should have one private double instance variable representing the worker payrate of $20.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Each derived class constructor must call the base Employee constructor with the name and type parameters. Derived classes co not provide a method override for getName() or getType( base Employee class implementation is inherited. ). The The Employee Demo class (download provided below) is the driving program that will create the array and print the corresponding entered data. The order that you compile your Java source files is important. You must have your Employee.java file written and compiled before you can compile any of the derived classes (e.g. Manager.java) that extend from the class Employee. All the Employee derived classes must be compiled before you can compile your Employee Demo source file containing main() and getEmployee ( ). The requirement is that if you use a class name in you code, the Java compiler must be able to find the compiled.class file for that class while compiling the code. Sample Output The output of the EmployeeDemo program should look similar to the following (output is handled by the EmployeeDemo program, you do not need to do anything to it): Enter a list of Employees 'done' to end Enter the employee's type (or 'done)... executive Enter the employee's name.... B111 Enter the employee's type (or 'done)... worker Enter the employee's name.... Bally Enter the employee's type (or 'done).... manager Enter the employee's name... Eunice Enter the employee's type (or 'dona)... dona The list of employees entered... Bill, executive, su.uu/nour, $2,000.00 weOKLY Sally, worker, $20.00/hour, $800.00 weekly Eunice, manager, $35.00/hour, $$1,400 weekly In this project, you'll create a hierarchy of Java classes representing various types of employees in at company (executive, manager, worker). Each different employee class will have its own.java source file, and will be derived from the base class Employee. For the root of the Employee class hierarchy, write a class named Employee that will be the base class of all the other Employee types. It should have two private String instance variables representing the employee's name and type, and a private double instance variable representing the employee's hourly payrate. The class should have the following public methods: public Employee (String type, String name) a constructor that sets the type and name instance values. public String getName()-this method returns the object's name value. public String getType()-this method returns the object's type value. public double get Payrate () this method returns the object's hourly payrate. It must be overridden in each class. For the base Employee class, this method retums 0.0. public double payCheck (this method computes and retums the object's weekly payCheck amount by multiplying their hourly rate (different for each type) by 40 hours. It must be overridden in each derived class. For the base Employee class, this method returns 0.6. public String toString(this method returns the object's description (name, type, payrate, and paycheck) as a String it must be overridden in each derived class. For the hase Empl nyer class this method returns the string "generic employee". Write a Executive class that extends Employee. It should have one private double instance variable representing the executive payrate of $50.00 per hour, and should have the following public methods: public Executive (String type, String name) - a constructor that invokes the base constructor (passing the type and name), then sets the payRate instance variable. public double get Payrate () this method returns the object's hourly payrate. public double payCheck (this overriding method computes and returns the Executive object's hourly payrate. public String toString( this overriding method retums the Executive object's description ((name, type, payrate, and paycheck). Write a Manager class that extends Employee. It should have one private double instance variabe representing the manager payrate of $35.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Write a Worker class that extends Employee. It should have one private double instance variable representing the worker payrate of $20.00 per hour. It should also have a constructor and overriding methods for getPayrate), payCheck ( ), and toString(). Each derived class constructor must call the base Employee constructor with the name and type parameters. Derived classes co not provide a method override for getName() or getType( base Employee class implementation is inherited. ). The The Employee Demo class (download provided below) is the driving program that will create the array and print the corresponding entered data. The order that you compile your Java source files is important. You must have your Employee.java file written and compiled before you can compile any of the derived classes (e.g. Manager.java) that extend from the class Employee. All the Employee derived classes must be compiled before you can compile your Employee Demo source file containing main() and getEmployee ( ). The requirement is that if you use a class name in you code, the Java compiler must be able to find the compiled.class file for that class while compiling the code. Sample Output The output of the EmployeeDemo program should look similar to the following (output is handled by the EmployeeDemo program, you do not need to do anything to it): Enter a list of Employees 'done' to end Enter the employee's type (or 'done)... executive Enter the employee's name.... B111 Enter the employee's type (or 'done)... worker Enter the employee's name.... Bally Enter the employee's type (or 'done).... manager Enter the employee's name... Eunice Enter the employee's type (or 'dona)... dona The list of employees entered... Bill, executive, su.uu/nour, $2,000.00 weOKLY Sally, worker, $20.00/hour, $800.00 weekly Eunice, manager, $35.00/hour, $$1,400 weekly
Expert Answer:
Related Book For
Introduction To Health Care Management
ISBN: 9781284081015
3rd Edition
Authors: Sharon B. Buchbinder, Nancy H. Shanks
Posted Date:
Students also viewed these databases questions
-
Consider Hoare triples of the form {T} V := E {V = E} where T is the atomic formula 'true' and V and E range over variables and expressions, respectively. (i) Write down an instance of such a triple...
-
ABC Company produces and sells I product. Once the products are produced, they are sold, and there is no work-in- process, no any inventory in stock. Company uses standard costing method in its...
-
Let f (x) = (x 1)10, p = 1, and pn = 1 + 1/n. Show that |f (pn)| < 103 whenever n > 1 but that |p pn| < 103 requires that n > 1000.
-
write the answers with examples of the law of contract and the correct articles of the relevant law in each paragraph so that those articles can be used as a reference GSM Africa is a group of...
-
The frequency distribution shows volumes of sales (in dollars) and the number of months in which a sales representative reached each sales level during the past three years. Using this sales pattern,...
-
In addition to a Gantt chart, youve drawn Brian a PERT diagram so that you can communicate the necessity to keep an eye on the critical path. Consult Figure which was derived from the data from...
-
Molin Corporation is a manufacturer that uses job-order costing. The company closes out any overapplied or underapplied overhead to Cost of Goods Sold at the end of the year. The company has supplied...
-
5. An urn contains five red and three greens balls. The balls are chosen at random, one by one, from the urn. If a red ball is chosen, it is removed. If a green ball is chosen, it is returned to the...
-
Choose any nation and identify: o Its foreign policy in detail o Location of embassies o Identify one of its current Ambassadors and provide background on the Ambassador o Find the country to which...
-
How do work-life balance choices vary depending on variables like age, gender, or disability status? Is it up to the individual to overcome personal adversities, or should the social structure seek...
-
A dance studio can accept no more than 40 students for any 1 hour time period. Ballet and modern dance are offered during the same one-hour period. There needs to be at least 12 students in ballet...
-
Explain what the scope triangle is. Why is it important to consider the scope triangle variables in managing a project?
-
A drug trial concludes that a certain cancer-fighting drug does NOT work. However, in reality the drug does work. But the trial didn't have enough participants to detect the effect. What kind of...
-
Read Chapter 7, Recruiting, in the Strategic Staffing textbook. Navigate to the discussion thread and respond to the following questions taken from the Opening Vignette ExerciseUnited Parcel Service,...
-
Discuss whether responsible human resources management should apply different standards for the home company and suppliers, for developed countries and developing countries, and for large companies...
-
A slider bearing consists of a sleeve surrounding a cylindrical shaft that is free to move axially within the sleeve. A lubricant (e.g., grease) is in the gap between the shaft and the sleeve to...
-
By making use of the analogies between the various transport models for molecular transport of conserved quantities, describe how you would set up an experiment to solve each of the following...
-
What is the "system" in Example 1.3? Example 1.3 With respect to Figure 1.1, consider the two parallel flat surfaces spaced 1 mm apart, with a Newtonian grease between them that has a viscosity of...
Study smarter with the SolutionInn App