Are you stressed by poor grades and tight deadlines? We have your back. We can do this or a different assignment for you at an affordable price. Use writing services to score better and meet your deadlines.

Order a Similar Paper Order a Different Paper

FIle name: SiblingExt




Inheritance involves creating a class by extending another class. The extended class is called a child class and the original class is called the parent class. For creating a child class, we need the .class file of the parent class.

The child class is created by adding an extends clause in the child class header.

Once created, an object of the child class contains all the instance variables and constructors and instance methods of child, parent and parent’s parent (ancestor) classes.

The object of the child class is created by using a child class constructor. Java requires that a child class constructor call parent class constructor as its first statement using reserved word super.


Write a program that will input the names, ages, weights and heights of three siblings and display the lightest followed by the youngest followed by the tallest of the siblings.

This program will be an enhancement of a previous exercise that did the same. However, this program will additionally provide for inputting height and displaying the tallest sibling.

Do this assignment using inheritance as described in implementation section below.


For this assignment create the following classes.


Create a class Sibling with private instance variables for name, age and weight. Provide a constructor with parameters for initializing name, age and weight. Also provide accessor methods for getting name, age and weight.

The content of this class will be identical to the one in the previous exercise. You may copy the contents of this class from the previous exercise.


Create a class SiblingExt that will extend the class Sibling above and will provide a private instance variable for keeping height. It will provide a constructor with parameters for initializing name, age, weight and height. This constructor will call the parent constructor for initializing name, age and weight and will initialize the height by itself. The class will also provide an accessormethod for getting height. (Since this class extends the Sibling class, the accessor methods from the Sibling class for getting name, age and weight will be part of an object of this class).


Write a class TestSiblingExt containing the main method. In the main method, input the name, age, weight and height of each sibling and create a corresponding SiblingExt object containing the data.

After all SiblingExt objects are created, the main method will display the data for the lightest sibling followed by the youngest sibling followed by the tallest sibling. The data will include the sibling name, age, weight and height of the sibling. Use the object accessor methods for getting object data.

This class can be created by modifying the TestSibling class in the previous exercise. You may copy the contents of TestSiblingclass from a previous exercise and then modify them to create this class.


Do the above assignment without using an array of objects.


Creating a SiblingExt object

String name = “John Doe”;

int age = 20;

int weight = 150;

int height = 70;

//Create SiblingExt reference

SiblingExt sibe;

//Create an object of SiblingExt class

sibe = new SiblingExt (name, age, weight,height);

Runtime Steps In Creating SiblingExt Object

Load the Class SiblingExt (SiblingExt.class file) in memory to use it as a blue print.

Load the Class Sibling (Sibling.class file) in memory to use it as a blue print.

Load the class Object (Object.class file) in memory to use it as a blue print.

Create a part of the object using the blue print Object.

Create an additional part of the object using the blue print Sibling.

Create the final part of the object using the blue print SiblingExt.

Call the SiblingExt constructor of the created object.

The SiblingExt constructor will call the Sibling constructor.

The Sibling constructor will call the Object constructor.

Object creation and initialization is completed. The object will contain instance variables and associated constructors and methods from all three blue prints (Object, Sibling, SiblingExt). Return the reference of the object.

Chain Of Constructor Calls

Java requires that the first statement in each constructor be a call to the parent constructor using the reserve word super. If the user does not include this call, the compiler adds such a call with no parameters. If such a constructor does not exist in the parent class, the compiler issues an error.

The above rule results in the following:

A call to a constructor results in a chain of constructor calls.

The sequence of constructor calls is from bottom (child) to top (parent).

The sequence of constructor call completion is from top (parent) to bottom (child).


//Sample code for SiblingExt

public class SiblingExt extends Sibling


private int height;

public SiblingExt (String n, int a, int w, int h )


super (n,a,w );

height = h;


public int getHeight ( )


return height;





For testing, use the following input data:

Jack 21 130 69

Judy 24 118 63

John 26 145 70

Note that in the above data Jack is 21 year old, weighs 130 lbs and is 69 inches tall.


The program output may appear as below:

The Lightest Sibling: Judy 24 118 63

The Youngest Sibling: Jack 21 130 69

The Tallest Sibling: John 26 145 70


Submit the source code and the final output only.

We offer CUSTOM-WRITTEN, CONFIDENTIAL, ORIGINAL, and PRIVATE writing services. Kindly click on the ORDER NOW button to receive an A++ paper from our masters- and PhD writers.

Get a 10% discount on your order using the following coupon code SAVE10

Order a Similar Paper Order a Different Paper