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

JAVA , THANK YOU. please read yellow highlight. Exercise 00063_ deadline: 0915 2

ID: 3746219 • Letter: J

Question

JAVA , THANK YOU. please read yellow highlight.

Exercise 00063_ deadline: 0915 2018 11:59 PM WORK AREA Assume that the following class has been created. Do not write any import statements. . The Aeroplane class has a String attribute called manufacturer, and another String attribute called modelNumber. It also has a primitive integer attribute called numberOfJets. These are all set by the constructor in that order. What you need to do: 1.) Write a sub-class of the Aeroplane class called PassengerAeroplane (Do NOT use the public keyword when declaring this class.) 2.) Your sub-class should have a private boolean attribute called firstClassCabin 3.) Your sub-class should have a constructor that takes four parameters: two Strings, a primitive integer, and a boolean 4.) The first parameter should be of type String and be called manufacturer 5.) The second parameter should be of type String and be called modelNumber 6.) The third parameter should be of primitive type integer and be called numberOfJets 7.) The fourth parameter should be of primitive type boolean and be called firstClassCabin 8.) The constructor should call the super class constructor using the super keyword using the two String parameters 'manufacturer', 'modelNumber, and the primitive integer parameter 'numberOfJets' in that order 9.) The constructor should initialise the firstClassCabin attribute with the value passed into the constructor 10.) The PassengerAeroplane class should have a public 'getter' method called 'getFirstClassCabin)' that returns the value of the private instance variable 'firstClassCabin

Explanation / Answer

Answer :

public class Aeroplane {

//that assue calss created here as Aeroplane with the 3 fields. with the constructor of Aeroplane.

String manufacturer;

String modelNumber;

int numberOfJets;

public Aeroplane(String manufacturer, String modelNumber, int numberOfJets) {

this.manufacturer = manufacturer;

this.modelNumber = modelNumber;

this.numberOfJets = numberOfJets;

}

}

class PassengerAeroplane extends Aeroplane{

//here i have created the subclass PassengerAeroplane which extend to the Aeroplane class.

private boolean firstClassCabin;// created the firstClassCabin is the private boolean variable here.

// create the subclass constructor with the 4 parameters and calling super class constructor into the subclass constructor.

//and initialize the firstClassCabin variable here.

public PassengerAeroplane(String manufacturer, String modelNumber, int numberOfJets, boolean firstClassCabin) {

super(manufacturer, modelNumber, numberOfJets);

this.firstClassCabin=firstClassCabin;

}

/**

* @return the firstClassCabin

*/

//generate the getFirstClassCabin() method here that returns the value of firstClassCabin private instance variable.

public boolean getFirstClassCabin() {

return firstClassCabin;

}

/**

* @param firstClassCabin the firstClassCabin to set

*/

public void setFirstClassCabin(boolean firstClassCabin) {

this.firstClassCabin = firstClassCabin;

}

}

Thanks...