Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

25. [6 marks] Add proper class and interface definitions to make the following code compile. Your design must satisfy the following constraints: (i) Human and

image text in transcribed

25. [6 marks] Add proper class and interface definitions to make the following code compile. Your design must satisfy the following constraints: (i) Human and SuperHero must be defined as classes; (ii) all other undefined types must NOT be defined as classes; (iii) the inheritance structure that you write must have at most 2 levels (the object class is not counted as a level of the inheritance; you only need to consider the classes and interfaces used in this question). Note that the bodies of methods fly, transform and fight can be left empty and the return types are void. There should be NO statements inside the methods. public class Adventure f public static void demoFly (CanFly flyer) f flyer.fly) public static void demoTransform (CanTransform transformer) transformer.transform); public static void demoFight (Human human) human.fight); public static void main (String args []) SuperHero ironman -new SuperHero (); demoFly (ironman); demoTransform (ironman); demoFight (ironman) 25. [6 marks] Add proper class and interface definitions to make the following code compile. Your design must satisfy the following constraints: (i) Human and SuperHero must be defined as classes; (ii) all other undefined types must NOT be defined as classes; (iii) the inheritance structure that you write must have at most 2 levels (the object class is not counted as a level of the inheritance; you only need to consider the classes and interfaces used in this question). Note that the bodies of methods fly, transform and fight can be left empty and the return types are void. There should be NO statements inside the methods. public class Adventure f public static void demoFly (CanFly flyer) f flyer.fly) public static void demoTransform (CanTransform transformer) transformer.transform); public static void demoFight (Human human) human.fight); public static void main (String args []) SuperHero ironman -new SuperHero (); demoFly (ironman); demoTransform (ironman); demoFight (ironman)

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

Inductive Databases And Constraint Based Data Mining

Authors: Saso Dzeroski ,Bart Goethals ,Pance Panov

2010th Edition

1489982175, 978-1489982179

More Books

Students also viewed these Databases questions