Question

2. Given following Java program, convert to class diagram, create two instances of Employee, and initialize...

2. Given following Java program, convert to class diagram, create two instances of Employee, and initialize them with following values:

For employee1, name – your friend’s name, salary = 30000, 8 hours and avail is false

For employee2, name – your friend’s name, salary = 80000, 10 hours and avail is true public

class Employee {

private String name;

private double salary ;

private int hours ;

private boolean avail ;

public Employee (double r, double h, boolean hd) { salary = r; hours = h; avail = hd; }

public double getSalary() { return salary; }

public double getHour() { return hour; }

public boolean getAvail() { return avail; }

//other methods } public class Secretary extends Employee {

public Secretary(double r, double h, boolean hd) { super(r, h, hd); }

public String supervisedBy() { return name; }

}

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
2. Given following Java program, convert to class diagram, create two instances of Employee, and initialize...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • In Java: Executable Class create an array of Employee objects. You can copy the array you...

    In Java: Executable Class create an array of Employee objects. You can copy the array you made for Chapter 20. create an ArrayList of Employee objects from that array. use an enhanced for loop to print all employees as shown in the sample output. create a TreeMap that uses Strings for keys and Employees as values. this TreeMap should map Employee ID numbers to their associated Employees. process the ArrayList to add elements to this map. print all employees in...

  • 5 The following two classes are related by inheritance. Fill in the three (3) blanks as...

    5 The following two classes are related by inheritance. Fill in the three (3) blanks as follows: (a and b) initialize the instance variable "name," (c) calculate a the current pay for a special employee who is paid a portion of their salary plus a bonus each pay period. (Note that the code may not illustrate all class methods.) public class Employee private String name; private double salary; public Employee(String name) public double pay) return salary /24 public class SpecialEmployee...

  • 12. Predict the output generated at the marked println lines in the following program. The program...

    12. Predict the output generated at the marked println lines in the following program. The program makes use of the class Employee that is also given. Please enter your answers in the space provided below the code. public class Employee { private String name; private double salary; public Employee(String name, double salary) { this.name = name; this.salary = salary; } public String getName() { return name; } public double getSalary() { return salary; } public void raiseSalary(double percent) { double...

  • Task 3: Main Program Create a main program class that: Creates three or more Nurse instances...

    Task 3: Main Program Create a main program class that: Creates three or more Nurse instances assigned to different shifts. Creates three or more Doctor instances. Creates three or more Patient instances with pre-determined names and manually assigned physicians chosen from the pool of Doctor instances previously created. Generates another 20 Patient instances using randomly generated names and randomly assigns them physicians chosen from the pool of Doctor instances previously created. Prints the toString() values for all employees. Prints the...

  • 4. Create a Business class. This class should store an array of Employee objects. Add a...

    4. Create a Business class. This class should store an array of Employee objects. Add a method to add employees to the Business, similar to addFoodItem in the Meal class. Add two more methods for the Business class: getHighestPaid(), which returns the Employee who has been paid the most in total, and getHighestTaxed(), which returns the Employee who has been taxed the most in total. Note: you do not need to handle the case of ties. These are all the...

  • Java Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEm...

    Java Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEmployee, HourlyEmployee which extend the Employee class and implements that abstract method. A Salary Employee has a salary, a Commision Employee has a commission rate and total sales, and Hourly Employee as an hourly rate and hours worked Software Architecture: The Employee class is the abstract super class and must be instantiated by one of...

  • In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate...

    In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate the pension to date as the equivalent of a monthly salary for every year in service. 4) Print the calculated pension for all employees. ************** I added the interface and I implemented the interface with Employee class but, I don't know how can i call the method in main class ************ import java.io.*; public class ManagerTest { public static void main(String[] args) { InputStreamReader...

  • Please answer the following question with Java Modify the Employee and ProductionWorker classes provided below so...

    Please answer the following question with Java Modify the Employee and ProductionWorker classes provided below so they throw exceptions when the following errors occur. - The Employee class should throw an exception named InvalidEmployeeNumber when it receives an employee number that is less than 0 or greater than 9999. - The ProductionWorker class should throw an exception named InvalidShift when it receives an invalid shift. - The ProductionWorker class should thrown anexception named InvalidPayRate when it receives a negative number...

  • DataSetEmployee Can you please help me the JAVA program? Here is the requirement. Rewrite DataSetBook to...

    DataSetEmployee Can you please help me the JAVA program? Here is the requirement. Rewrite DataSetBook to be DataSetEmployee. DataSetEmployee should extend ArrayList<Employee> and have no instance variables. You'll have to decide what replaces the getPages concept for getMax/getMin. As a hint, what method of Employee returns a numeric value? Make a package com.acme.midmanager. This package should contain the Manager class. Make a package com.acme.personnel. This package should contain the DataSetEmployee class. Make a package com.acme.topmanagement. This package should contain the...

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