Let us consider an inheritance
relation to model composite states for an Employee class. Use the
State pattern to implement the following state-chart for the
Employee class
|
Employee |
Start
|
Suspended |
Bad behavior
Good
Behavior
|
Sub ordinate |
|
Boss |
Promote
Demote
Stop
State chart diagram describes the follow of all states. In the above diagram we can discuss all states and its follow for Employee class.
Let us consider an inheritance relation to model composite states for an Employee class. Use the...
Swift code import Foundation protocol TaksPerformer { func doAThing() } class Employee: TaksPerformer { let name: String var boss: Boss? init(name: String) { self.name = name } func doAThing() { print("\(name) is doing a thing") } } class Boss { var employee: Employee let name: String init(name: String, employee: Employee) { self.name = name self.employee = employee employee.boss = self } func actLikeABoss() { employee.doAThing() } } // 1) // A) What is wrong with the current implementation of Boss...
Let us consider the builder pattern where Product has four possible parts Part1, Part2, Part3, and Part4 (all integer). Assume we have three concrete builders: ConcreteBuilder1, ConcreteBuilder2, and ConcreteBuilder3. ConcreteBuilder1 assigns 11, 12, 13, and 14 to Part1, Part2, Part 3, and Part4 respectively. ConcreteBuilder2 assigns 21, 22, 23, and 24 to Part1, Part2, Part 3, and Part4 respectively. ConcreteBuilder3 assigns 31, 32, 33, and 34 to Part1, Part2, Part3, and Part4 respectively. 1) Give the UML diagram. 2) Implement...
Please help!
(a) Let us consider a full model of a balanced (all t treatments have equal number of observations r) CRD design with t treatments and r replications of each treatment, hence having n-rt observations. 2. i. Minimizing sum of square error Δfull (μ'Ti) -Σι-1 Σ-1 (Vi,- μ-Ti)2 with respect to μ and Ti find the least square estimators of μ and Ti as μ and Ti. Hint: Take derivative of the objective function with respect to μ and...
2. (a) Let us consider a full model of a balanced (all t treatments have equal number of observations r) CRD design with t treatments and r replications of each treatment, hence having n-rt observations i. Minimizing sum of square error Δfull(μ, Tỉ)-Σι-12jai (Vij-l-ri)2 with respect to μ and Ti find the least square estimators of μ and Te as μ and Ti Hint: Take derivative of the objective function with respect to u and Ti and equate then to...
Consider the human capital growth model. Let us make the following changes. Depending on whether the current calendar year is an odd or even number, the efficiency parameter of the human capital accumulation technology changes between 5.15 and 2.04. In particular, when the calendar year is an odd number (for example in years 1 and 3) the parameter b is 5.15 and z is 6. However, in even years (for example in years 2 and 4) the parameter is 2.04...
C++
Program 2 Consider a class Employee with data members: age (an integer), id (an integer) and salary (a float), and their corresponding member functions as follows: class Employee { private: int age; int id; float salary: public: Employee; // default constructor: age=0, id=0, and salary=0 void setAge(int x); // let age = x void setId(int x); // let id = x void setSalary(float x); // salary = x int getAge(); // return age int getId; // return id float...
Create a date class with attributes of month, day, and year. Create an employee class for storing information related to employee information for the CS1C Corporation. This class should contain the employee’s name, employee’s Id, phone number, age, gender, job title, salary, and hire date. You should write a series of member functions that change the employee’s name, employee’s Id, phone number, age, job title, salary, and hire date. You should use your date class (composition) when accessing hire date....
Create a date class with attributes of month, day, and year. Create an employee class for storing information related to employee information for the CS1C Corporation. This class should contain the employee’s name, employee’s Id, phone number, age, gender, job title, salary, and hire date. You should write a series of member functions that change the employee’s name, employee’s Id, phone number, age, job title, salary, and hire date. You should use your date class (composition) when accessing hire date....
//*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...
2) Consider the Stackelberg Model of Duopoly in the class slides. Assume that Firm 1 and Firm 2 have different marginal costs of productions—that is, Firm 1’s marginal cost of production is c1 and Firm 2’s is c2. Under this assumption, answer the following questions. i) Let Firm 1 choose its quantity first. Find Firm 2’s reaction function and the backwards-induction outcome of the game. Also, find the profit of each firm at the backwards-induction outcome. ii) Let Firm 2...