Please read carefully: The remaining questions from this exa…

Please read carefully: The remaining questions from this exam are all part of the same problem, divided into many smaller questions. You will be asked to write 2 classes: Worker (an abstract class) and SoftwareEngineer (a concrete class, and child of Worker). Each question will indicate the part and class you will be working on. Do NOT write getters and setters unless otherwise indicated. You won’t need any that are not indicated (and you cannot use any that are not indicated). Do NOT write Javadocs. All your constructors and methods should be visible to all classes unless otherwise noted in their description. All your instance variables and class variables should have the strictest visibility modifier. When asked for constructors or methods, do not repeat the class header or any other code. Constructors and setters must use parameter names that are the same as the related instance variable(s). You should use constructor chaining in all constructors where it can be properly applied. Your chaining must reduce the necessary code in the constructors as much as possible. You don’t need null-checks for String variables. Syntax, capitalization, and spelling matter. Canvas Tip for all Qs: Click on the dropdown that says “Paragraph” and switch to “Preformatted” to get a monospaced font – this can help in coding answers The questions begin below.

Write a constructor for SoftwareEngineer. The constructor wi…

Write a constructor for SoftwareEngineer. The constructor will take the name, money, company, salary, and companyProject, and set all instance variables appropriately. Remember that you cannot directly assign to the variables in Worker, and that SoftwareEngineer is a child class.

Write another constructor for SoftwareEngineer. The construc…

Write another constructor for SoftwareEngineer. The constructor will take only a name and a company and set all instance variables appropriately. This constructor will be used for software engineers with $25000 who are paid $50/hr and are working on the “website” project for a company.

Write a constructor for Worker. The constructor will take th…

Write a constructor for Worker. The constructor will take the name, money, company, and salary, and set all instance variables appropriately. The constructor should also update the numberOfWorkers variable to indicate that there’s a new worker. Note: even though the class is abstract, this doesn’t affect anything on the constructor. You can treat the class as any concrete class in this particular question.

Consider the below method. Provide two method headers: one t…

Consider the below method. Provide two method headers: one that overrides the given, and one that overloads it. private int foo(String str, double dbl) { // method body } Use this template for your answer (please type fully – you cannot copy): Overriding method header: Overloading method header:

[2pts EXTRA CREDIT] Write a concrete toString method for Sof…

 Write a concrete toString method for SoftwareEngineer. The String representation of a SoftwareEngineer is: “My name is , and I work at . I have $ and receive $/hr. I write software for ’s ” (without the square brackets, replacing the square brackets with the values from the instance variables) Notice the prefix matches the toString from Worker (which ends in $/hr, and is marked). You must call Worker’s toString and use its returned value.

Write a concrete method with protected visibility for Worker…

Write a concrete method with protected visibility for Worker called earnMoney. It receives an int (increment), which indicates how much money a worker’s money will be increased by. If the parameter is positive, the worker’s money will be adjusted accordingly, otherwise, it should do nothing.