Question
The BusinessPlane class extends Airplane. It has one additional instance variable, boolean isJet, that is true if the plane has jet engines and is false
The BusinessPlane class extends Airplane. It has one additional instance variable, boolean isJet, that is true if the plane has jet engines and is false if it has some other form of propulsion. Since most BusinessPlane objects have jet engines, it is not necessary to input the initial value of the isJet instance variable in the constructor. Instead, the instance variable is given an initial value of true. But a modifier method is provided to change the value if necessary. Complete the following definition for the BusinessPlane class:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class BusinessPlane extends Airplane
{
private boolean isJet;
public BusinessPlane( double weight, double length )
{
super (weight, length);
isJet = true;
}
public boolean getJet(){
if (n = 0){
return false;
}
}
public void setJet(boolean n){
return n;
}
}
Complete the following definition for the BusinessPlane class: public class BusinessPlane extends Airplane 1 2. 3 4 5 private boolean is Jet; public Business Plane( double weight, double length ) 2 super (weight, length); isJet = true; } 10 10 11 - 12 - 13 public boolean getJet() { if (n 0) { return false; 1 public void setJet (boolean n) { return n; 17 18 19 } public static void main(String[] args) // test your code here Business Plane b = new BusinessPlane ( 8709.5, 17.6); 1 2. 3 4 5 6 7 8 9 System.out.println( b.getJet() ); // should output true b.setJet( false); System.out.println( b.getJet() ); // should output false }Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started