Question 4 0 out of 10 points Suppose you had two data definition classes, Disease and ViralDisease. ViralDisease extends Disease. Assume in your implementation class, you had created an array of Disease objects. When looping through the array of Disease objects, how would you check to see if the current object was a ViralDisease? Question 3 Given the following class hierarchy and implementation class below, what would be the output on line 18. 1 public abstract class Product ( 2 3 } public abstract String WhatAmI (); 4 public class Book extends Product { public String WhatAmI () { 456 7 8 } 9 10 11 12 ) return "I am a Book"; public class Magazine extends Product { public String WhatAmI () 13) } return " I am a Magazine"; 14 public class Product Implementation ( public static void main(String[] args) { 15 16 17 18 19 } 20 } Product pl == new Book (); Product p2 = new Magazine (); JOptionPane.showMessageDialog(null, pl. WhatAmI ()); D 10 out of 10 points
Question 4 0 out of 10 points Suppose you had two data definition classes, Disease and ViralDisease. ViralDisease extends Disease. Assume in your implementation class, you had created an array of Disease objects. When looping through the array of Disease objects, how would you check to see if the current object was a ViralDisease? Question 3 Given the following class hierarchy and implementation class below, what would be the output on line 18. 1 public abstract class Product ( 2 3 } public abstract String WhatAmI (); 4 public class Book extends Product { public String WhatAmI () { 456 7 8 } 9 10 11 12 ) return "I am a Book"; public class Magazine extends Product { public String WhatAmI () 13) } return " I am a Magazine"; 14 public class Product Implementation ( public static void main(String[] args) { 15 16 17 18 19 } 20 } Product pl == new Book (); Product p2 = new Magazine (); JOptionPane.showMessageDialog(null, pl. WhatAmI ()); D 10 out of 10 points
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.1: Classes
Problem 1E
Related questions
Question
Answer the JAVA OOP problems

Transcribed Image Text:Question 4
0 out of 10 points
Suppose you had two data definition classes, Disease and ViralDisease. ViralDisease extends Disease. Assume in your implementation
class, you had created an array of Disease objects. When looping through the array of Disease objects, how would you check to see if the
current object was a ViralDisease?
![Question 3
Given the following class hierarchy and implementation class below, what would be the output on line 18.
1 public abstract class Product (
2
3 }
public abstract String WhatAmI ();
4 public class Book extends Product {
public String WhatAmI () {
456
7
8 }
9
10
11
12
)
return "I am a Book";
public class Magazine extends Product {
public String WhatAmI ()
13)
}
return " I am a Magazine";
14 public class Product Implementation (
public static void main(String[] args) {
15
16
17
18
19
}
20 }
Product pl
==
new Book ();
Product p2 = new Magazine ();
JOptionPane.showMessageDialog(null, pl. WhatAmI ());
D
10 out of 10 points](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6fce8742-cc7e-4301-a659-4aa9849c80b3%2Fa7e1c528-3866-4cbf-9cf8-92d80fa89c8b%2Flkom8h_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Question 3
Given the following class hierarchy and implementation class below, what would be the output on line 18.
1 public abstract class Product (
2
3 }
public abstract String WhatAmI ();
4 public class Book extends Product {
public String WhatAmI () {
456
7
8 }
9
10
11
12
)
return "I am a Book";
public class Magazine extends Product {
public String WhatAmI ()
13)
}
return " I am a Magazine";
14 public class Product Implementation (
public static void main(String[] args) {
15
16
17
18
19
}
20 }
Product pl
==
new Book ();
Product p2 = new Magazine ();
JOptionPane.showMessageDialog(null, pl. WhatAmI ());
D
10 out of 10 points
AI-Generated Solution
Unlock instant AI solutions
Tap the button
to generate a solution
Recommended textbooks for you

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning