Question: JAVA Imagine you are employed as a Java programmer at an automated toy factory. This factory has 2 types of robots. Assembly robots and verification

JAVA

Imagine you are employed as a Java programmer at an automated toy factory. This factory has 2 types of robots. Assembly robots and verification robots. Every robot has 2 attributes. An alphanumeric identifier and a health status which can be in 3 states { Good, Service Due, Malfunctioning }. An assembly robot can create new toys using its create method. A verification robot can verify toys by using its verify method.

While taking advantage of inheritance, define classes AssemblyRobot and VerificationRobot. Create a Toy Class that has one String attribute toyType. Add the method create to the AssemblyRobot class. This method takes a String toyType as a parameter and returns a Toy object with that string as its toyType. Add a verify method to the verification robot. This method takes in a Toy object and a String toyType and returns true if the Toy is of the same toyType.

In a class ToyFactory Create one assembly robot and one verification robot. Make your assembly robot create 2 toys. Have your verification robot verify if both are trucks. Have one fail verification have one pass.

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!