Which of the statements is FALSE regarding the following program? class Car { } protected double m_mpg; public Car (double mpg) (m_mpg = mpg;} "1 void printMPG () (System.out.println("Car - + m_mpg); } class Sedan extends Car [ public int m_numDoors; public Sedan (int mpg, int numDoors) { super (mpg); m numDoors = numDoors; } } void printMPG () (System.out.println("Sedan void print Doors () (System.out.println("Sedan m numDoors); } void increaseMPG () {m_mpg++; } 1. class Test Driver { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. public static void main(String args[]) { Car cl= new Car (25); Car c2 = new Sedan (30, 4); Sedan c3 new Sedan (28, 2); cl.printMPG (); cl = c2; cl.increaseMPG (); c2.printMPG (); c3.m numDoors = 4; c3.printDoors (); c3.increaseMPG (); c2 = c3; c2.printMPG (); 11 + m mpg); } - "+

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter10: Object-oriented Programming
Section: Chapter Questions
Problem 16RQ
icon
Related questions
Question
100%
Which of the statements is FALSE regarding the following program?
class Car (
}
protected double m mpg;
public Car (double mpg) (m_mpg = mpg; }
void printMPG () (System.out.println("Car
class Sedan extends Car {
public int m numDoors;
public Sedan (int mpg, int numDoors) {
super (mpg);
m numDoors = numDoors;
}
void printMPG () (System.out.println("Sedan
void print Doors () (System.out.println("Sedan
m numDoors); }
void increaseMPG () {m mpg++; }
1. class Test Driver {
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
11
public static void main(String args[]) {
Car cl = new Car (25);
Car c2 = new Sedan (30, 4);
Sedan c3 = new Sedan (28, 2);
cl.printMPG ();
cl = c2;
cl.increaseMPG ();
c2.printMPG ();
c3.m numDoors = 4;
c3.printDoors ();
c3.increaseMPG ();
c2 = c3;
c2.printMPG ();
+ m mpg); }
FI + m mpg); }
"F
+
Transcribed Image Text:Which of the statements is FALSE regarding the following program? class Car ( } protected double m mpg; public Car (double mpg) (m_mpg = mpg; } void printMPG () (System.out.println("Car class Sedan extends Car { public int m numDoors; public Sedan (int mpg, int numDoors) { super (mpg); m numDoors = numDoors; } void printMPG () (System.out.println("Sedan void print Doors () (System.out.println("Sedan m numDoors); } void increaseMPG () {m mpg++; } 1. class Test Driver { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 11 public static void main(String args[]) { Car cl = new Car (25); Car c2 = new Sedan (30, 4); Sedan c3 = new Sedan (28, 2); cl.printMPG (); cl = c2; cl.increaseMPG (); c2.printMPG (); c3.m numDoors = 4; c3.printDoors (); c3.increaseMPG (); c2 = c3; c2.printMPG (); + m mpg); } FI + m mpg); } "F +
14.
15.
16.1
O
}
c2.printMPG ();
Line 11 prints "Sedan - 4".
Line 9 prints "Sedan - 30.0".
Line 10 raises a compile error.
Line 14 prints "Sedan - 29.0".
Line 8 raises a compile error.
Transcribed Image Text:14. 15. 16.1 O } c2.printMPG (); Line 11 prints "Sedan - 4". Line 9 prints "Sedan - 30.0". Line 10 raises a compile error. Line 14 prints "Sedan - 29.0". Line 8 raises a compile error.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Software Development
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage