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
icon
Related questions
Question

Answer the JAVA OOP problems

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?
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
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
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar questions
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning