Question: For this lab, we will write a Company Simulator where different employees or different levels will attempt to program stuff. However, there's a chance they

For this lab, we will write a "Company Simulator" where different employees or different levels will attempt to "program" stuff. However, there's a chance they might break something, and will have to call their Manager to fix it.

For this lab, we will write a "Company Simulator" where different employees

Download the Lab Starter Pack here: http://scrivnor.cikeys.com/files/150_s18/L06_StarterPack.zip

Task 1: Implement the Missing Code

* Employee.java

* `equals()`

* SoftwareEngineer.java

* `doWork()`

* `toString()`

* Add the job title to supers `toString` method's value.

* SoftwareManager.java

* Also includes the additional method `fixProblem()`.

* Essentially the same as Software Engineer, but with a different name.

* Executive.java

* `toString()`

* Add the job title to supers `toString` method's value.

* CompanySimulator.java

* Constructor method

* `initCompany()`

* Add SoftwareEngineer's and SoftwareManager's to the company.

* `handleProblem()`

Task 2: Make the Output Pretty

Modify the CompanySimulator.java's `displayCompany()` method to print the company in tab format (use `printf`) so it looks pretty. Your output should match:

or different levels will attempt to "program" stuff. However, there's a chance

Task 3: Read the Names From a File

Create a text file called `employees.txt` in the same directory as your java files.

Add this to the contents:

they might break something, and will have to call their Manager to

In `CompanySimulator.java`, remove the field `randomNames`.

In `CompanySimulator.java`, modify the method `initCompany()` to assign the names of the Employees from reading the file instead. The same rules as to who is a Software Manager vs. Software Engineer, using the line numbers as an index.

Recall that there may be some Exceptions you need to handle when reading from a file. You should test reading from files that do not exist as well.

Task 4

Write an abstract superclass called Number with a single abstract void method square. Write a subclass called RationalNumber that has two integer fields, numerator and denominator. Write a subclass called ComplexNumber that has two integer fields, real and complex. Implement the square() method for both subclasses which will print the number squared with a 5 decimal precision. Write a class called NumberClient and use the following main method to test for correctness.

Make sure your decimal numbers are "pretty."

fix it. Download the Lab Starter Pack here: http://scrivnor.cikeys.com/files/150_s18/L06_StarterPack.zip Task 1: Implement

??Java Class>> SoftwareEngineer edu.csuci.comp150.L06 FSoftwareEngineer) SoftwareEngineer(String,int) doWork():boolean > ??Java Class GEmployee C CompanySimulator edu.csuci.comp150.L06 o toString0:String edu.csuci.comp150.L06 a name: String a id: int a randomNames: Stringl > CompanySimulator) o initCompany():void e displayEmployees(:void o performWork():void e handleProblem(Employee):void o simulate(int):void SoftwareManager SoftwareManager() doWork):boolean Employee) edu.csuci.comp150.LO6 Employee(String,int) o getName():String o getld():int d doWork):boolean o toString):String o equals (Object):boolean FSoftwareManager(String,int) e fixProblem(:void e toString):String main(Stringl):void > C Executive edu.csuci.comp150.L06 > Manager edu.csuci.compl 50.?06 Executive() Executive(String,int) o fixProblem():void o doWork():boolean o fixProblem():void o toString0:String

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!