Answered step by step
Verified Expert Solution
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
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
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