Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

: Programming \'I Consider the Top class 1 public abstract class Top 2private in

ID: 3919771 • Letter: #

Question

: Programming 'I Consider the Top class 1 public abstract class Top 2private int x=12 protected String name; 4 public int age; public Top (String name)f this.name - name; age0; System.out println(x); 12 public abstract void foo(String f); 13 Create a Middle class that extends the Top class. The class should have a single constructor that takes two input parameters: a String (for name) and int (for age). Your constructor should not have any redundant code (i.e., code that is repeated elsewhere). The foo method of Middle should print (to standard output) the object's name and age. The foo method should not be able to be modified by a child class of Middle. Each Middle object also has an Integer attribute called middle that should be assigned to 42 when an object is created The Middle class should have an abstract method called bar that take no input parameters and returns void

Explanation / Answer

public abstract class Middle extends Top { private Integer middle = 42; public Middle(String name, int age) { super(name); this.age = age; } public void foo(String f) { System.out.printf("Name = %s, Age: %d ", name, age); } public abstract void bar(); }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote