//*Manager.java*// public interface Manager { public void handleCrisis(); }
_________________________________________________________ /**Employee.java**/ Public abstract class Employee { protected final String name; protected final int id; public Employee(String empName, int empId) { name = empName; id = empId; } public Employee() { name = generatedNames[lastGeneratedId]; id = lastGeneratedId++; } public String getName() { return name; } public int getId() { return id; } //returns true if work was successful. otherwise returns false (crisis) public abstract boolean work(); public String toString() { return name + " ID: " + id; } public boolean equals(Object other) { if (other instanceof Employee) { return equals((Employee)other); } return false; } public boolean equals(Employee other) { return other != null && name.equals(other.name) && id == other.id; } private static int lastGeneratedId = 0; private static String[] generatedNames = { "Leon Mcdonald", "Frankie Johnson", "Todd Rosenthal", "Mauricio Curran", "Randy Feinstein", "Donald Munoz", "Bonnie Barnhardt", "Gary Foley", "Brittney Wilson", "Lyndsay Loomis", "Madge Cartwright", "Stella Coan", "David Lafave", "Kimberly Matthews", "Dwayne Heckler", "Laura Payne", "Mary Luevano", "Walter Sizemore", "James Lawson", "Pat Nelson", "Sherry Leighton", "Anthony Tieman", "Lona Davis", "Ana Flores", "Richard Mcdonald", "Joseph Standley", "Nancy Eddy", "Joyce Shaw", "Philip Collings", "James Reay", "Barbara Acker", "Violet Cleary", "Maria Crawley", "Erin Hilton", "Evelyn Morales", "Leo Rose", "Dorothy Johnson", "Geoffrey Fogarty", "Jane Marin", "Daniel Tran", "Nancy Lee", "Peter Johnson", "Glenn Browning", "Mark Jaramillo", "Latina Gross", "Theresa Stutes", "George Thiel", "Robert Carney", "Janet Watts", "Michael English", "James Scott", "Elmer Honaker", "Brian Upton", "Dawne Miller", "Gretchen Bender", "John Carr", "Faith Gavin", "Traci Hill", "Joseph Miller", "Don Montoya", "Brandy Pritts", "Sandra Sheppard", "Charles Whitmer", "Ana Williams", "Elizabeth Murphy", "Michael Hollingsworth", "Claudine Dalton", "Harold Coleman", "Young Ayala", "Shelba Kirschbaum", "Tom Perez", "Amee Martin", "Maryanne Foote", "Sylvia Harrell", "Alexander Weibel", "Bruce Bailey", "Vincent Fidler", "Jack Wilbur", "Charles Pond", "Danielle Yocom", "John Kemp", "Jamie Casey", "Everett Frederick", "Emma Hazley", "Justin Lynch", "Tyler Miller", "Albert Reyes", "Wilbur Price", "Kimberly Halton", "Mary Underwood", "Raymond Garrett", "William Olive", "Joanne Smith", "Wilbert Howerton", "Selene Gross", "Jennie Andrews", "Jasper Barrows", "Robert Verdin", "Mark Mcallister", "Teri Morrissey" }; }
---------------------------------------------------------------------------------------------
//*CompanyStimulator.java*// import java.util.ArrayList; import java.util.Random; public class CompanySimulator { private int currentTime; private ArrayList<Employee> company; private void initCompany() { company = new ArrayList<Employee>(); company.add(new Executive()); for (int i = 0; i < 3; i++) { company.add(new SoftwareManager()); for (int j = 0; j < 2; j++) { company.add(new SoftwareEngineer()); } } } public void run(int runTime) { initCompany(); Random timeGen = new Random(); currentTime = 0; while (currentTime <= runTime) { int scheduledTime = timeGen.nextInt(10) + 1; currentTime += scheduledTime; System.out.println("Current Time: " + currentTime); performWork(); System.out.println("\n"); } } private void performWork() { for (Employee emp : company) { if (!emp.work()) manageCrisis(emp); } } private void manageCrisis(Employee emp) { //TODO Implement CompanySimulator.manageCrisis } /** * @param args */ public static void main(String[] args) { CompanySimulator sim = new CompanySimulator(); sim.run(100); } }
Sir I have taken your question
I will post solution later as I am not on my desk
Please be patient
//*Manager.java*// public interface Manager { public void handleCrisis(); } _________________________________________________________ /**Employee.java**/ Public abstract class Employee {...
Previous class code: 1) Employee.java ------------------------------------------------------------------------------- /** * */ package main.webapp; /** * @author sargade * */ public class Employee { private int empId; private String empName; private Vehicle vehicle; public Double calculatePay() { return null; } /** * @return the empId */ public int getEmpId() { return empId; } /** * @param empId * the empId to set */ public void setEmpId(int empId) { this.empId = empId; } /** * @return the empName */ public String getEmpName() { return...
C# Hey I am having trouble implementing additonal function to this assignment: Problem: Implement three IComparer classes on Employee - NameComparer, AgeComparer, and PayComparer - that allow Employees to be compared by the Name, Age, and Pay, respectively. Code: Employee.Core.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Employees { partial class Employee { // Field data. private string empName; private int empID; private float currPay; private int empAge; private string empSSN = ""; private string empBene...
HospitalEmployee Inheritance help please. import java.text.NumberFormat; public class HospitalEmployee { private String empName; private int empNumber; private double hoursWorked; private double payRate; private static int hospitalEmployeeCount = 0; //----------------------------------------------------------------- // Sets up this hospital employee with default information. //----------------------------------------------------------------- public HospitalEmployee() { empName = "Chris Smith"; empNumber = 9999; hoursWorked = 0; payRate =0; hospitalEmployeeCount++; } //overloaded constructor. public HospitalEmployee(String eName,...
Please fill in the remaining code necessary and follow the instructions below this is an abstract class; it represents an department in the company. This class cannot be instantiated (objects created), but it serves as the parent for other classes. Department – This class represents a department within the company. 1. Provide the implementation (the body) for the following methods: public int getDepartmentID()) public String getDepartmentName()) public Manager getManager()) 2. Fix the implementation for the following method– substitute “blah” with...
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...
Susceptible.java interface Susceptible { public boolean infect(Disease disease); public void forceInfection(Disease disease); public Disease getCurrentDisease(); public void setImmune(); public boolean isImmune(); public Point getPosition(); } Movable.java interface Movable { public void move(int step); } public class Point { private int xCoordinate; private int yCoordinate; /** * Creates a point at the origin (0,0) and colour set to black */ public Point(){ xCoordinate = 0; yCoordinate = 0; } /** * Creates a new point at a given coordinate and colour...
Java Programming Answer 60a, 60b, 60c, 60d. Show code & output. public class Employee { private int id; private String name; private int sal; public Employee(int id, String name, int sal) { super(); this.id = id; this.name = name; this.sal = sal; } public int getid) { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; public void setName(String name) { this.name = name; } public int get Sall) { return...
Java Do 72a, 72b, 72c, 72d. Code & output required. public class Employee { private int id; private String name; private int sal; public Employee(int id, String name, int sal) { super(); this.id = id; this.name = name; this.sal = sal; } public int getid) { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; public void setName(String name) { this.name = name; } public int get Sall) { return sal;...
JAVA: How do I output all the data included for each employee? I can only get it to output the name, monthly salary and annual salary, but only from the Employee.java file, not Salesman.java or Executive.java. Employee.java package project1; public class Employee { private String name; private int monthlySalary; public Employee(String name, int monthlySalary) { this.name = name; this.monthlySalary = monthlySalary; } public int getAnnualSalary() { int totalPay = 0; totalPay = 12 * monthlySalary; return totalPay; } public String...
How to solve this problem? Consider the following class : public class Store Public final double SALES TAX_RATE = 0.063B private String name; public Store(String newName) setName ( newName); public String getName () { return name; public void setName (String newName) { name = newName; public String toString() return "name: “ + name; Write a class encapsulating a web store, which inherits from Store. A web store has the following additional attributes: an Internet Address and the programming language in...