Question: (a) Is the code at line 8 and 9 in SemiDetached.java is legit? Justify your answer. (3 marks) (b) Rewrite House.java at line 5 and

 (a) Is the code at line 8 and 9 in SemiDetached.java

(a) Is the code at line 8 and 9 in SemiDetached.java is legit? Justify your answer. (3 marks)

(b) Rewrite House.java at line 5 and 6 for the variables can be accessed from the same class, from the same package, and from a subclass in a different package. (2 marks)

(c) Based on the code you have written in Q4(b), write a class named Bungalow in a package named my second home. Then, assign the value of roof room, roof toilet, and squareFeet to 6, 4, and 5000.00 respectively

Q4 Answer Q4(a)-Q4(e) based on Figure Q4(a) and Figure Q4(b). Line 1 2 3 Code //House.java package myhome; DO UN public class House private int noofRoom; private int noofToilet; public double square Feet; 8 FIGURE Q4(a) Code // Semi Detached.java package myhome; public class SemiDetached extends House { Line 1 2 3 4 5 6 7 8 9 10 11 public static void main(String[] args) { House myHouse = new House(); myHouse.noofRoom = 4; myHouse.noofToilet = 2; myHouse. square Feet = 3000.00; } FIGURE Q4(b)

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!