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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started