Question: Interfaces: 2 . You are provided with a starter code, which includes the classes: Machine, Person, and the interfaces Info and Storable. Analyze the code,
Interfaces: You are provided with a starter code, which includes the classes: Machine, Person, and the interfaces Info and Storable. Analyze the code, and then proceed with the following tasks. Answer the following questions: a What is the purpose of the showInfo method in the Info interface? How is it used in Person and Machine? b What does the store method represent in the Storable interface? c Modify the Person class to also implement Storable. Define what it means to store a person eg adding them to a database and implement this in the store method. II Add Method Overloading in the Machine Class: Task: Overload the start method in the Machine class to accept different parameters: startString mode: Prints "Machine started in mode mode". startint powerLevel: Prints "Machine started with power level powerLevel III. Create a New Class Robot That Extends Machine: Task: Create a Robot class that implements Info. The Robot class should have additional methods: executeTaskString task: Prints "Robot is executing task recharge: Prints "Robot is recharging". IV Implement aggregation: Task: Add a field in the Person class called Machine ownedMachine to represent the machine the person owns. Modify the greet method to print out the person's name and their machine's ID by calling the showInfo method of Machine. V Add a Vehicle Class That Implements Storable: Task: Create a Vehicle class that implements Storable and adds new functionality: drive: Prints "Vehicle is being driven". store: Prints "Vehicle stored in garage". Demonstrate the usage of Vehicle in the Main class. VI Create an Array of Info Objects: Task: In the Main class, create an array of Info objects, which can include Machine, Person, and Robot. Loop through the array and call the showInfo method for each object. VII. Add Logging to the Machine Class: Task: Modify the Machine class to include a logOperationString operation method, which prints a log message for each operation the machine performs eg starting, stopping Ensure that this method is called inside start stop and store VIII. Create a ControlPanel Class to Control Multiple Machines: Task: Create a ControlPanel class that has an ArrayList of Machine objects. Add methods: addMachineMachine m: Adds a machine to the control panel. startAllMachines: Starts all machines in the list. stopAllMachines: Stops all machines in the list.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
