Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

c. What groups were least represented? Why do you think this is so?

Answered: 1 week ago