Question: QUESTION 1 Consider the following Test2 class: public class Test2 public static void main(String[] args) Myclass p1 = new MyClass (1.74F); // height = 1.74

 QUESTION 1 Consider the following Test2 class: public class Test2 public

QUESTION 1 Consider the following Test2 class: public class Test2 public static void main(String[] args) Myclass p1 = new MyClass (1.74F); // height = 1.74 in m MyClass p2 = new MyClass(); // height = 0.76 in m Myclass p3 = new MyClass (pl); p2.setHgt (0.93F); p3.setHgt (1.65F); if (pl.isTaller (p2)) System.out.println("p1 is taller than p2"); else System.out.println("pi is not taller than p2"); System.out.println("Height of pl = "+p1.getHgt()); System.out.println("Information of p3: "+p3.display()); } } a) What are the differences between pl, p2, and p3 in terms of an object creation or instantiation? (3 marks) b) State the category of the methods below: i. setHgt() ii. istaller () iii. display() iv. getHgt () (2 marks) c) Write the complete implementation of MyClass class as public class Myclass {...} (10 marks)

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!