Question

5) This question deals with the concepts of subtyping. For this problem, assume that the following classes and their subclass
0 0
Add a comment Improve this question Transcribed image text
Answer #1

c.) Inheritance Graph

class A class B class C class D class E class F

d)

Statement Is it Type Correct
f.mc(b); N
e.md(d); N
d.ma(c); N
c.mb(e); N
f.mb(b); N
c.mc(e); N
b.ma(e); N
b.ma(a); N
b=a; N
a=d=e; N
Add a comment
Know the answer?
Add Answer to:
5) This question deals with the concepts of subtyping. For this problem, assume that the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Java questions QUESTION 8 Assume the following classes are each defined in their own java files...

    Java questions QUESTION 8 Assume the following classes are each defined in their own java files and compile public class A public void display { System.out.println("A's display"); public class B extends A{ public void display { System.out.println("B's display"); public class C extends A public void display { System.out.println("C's display"); public class D { public static void main(String args) { 3: int i = ((int)(Moth.random(* 10)) if (i == 0) a = new BO: else if (i == 1) a =...

  • please answer correctly. Language/Type Java Inheritance polymorphism Assume that the following classes have been defined: public...

    please answer correctly. Language/Type Java Inheritance polymorphism Assume that the following classes have been defined: public class George extends Elaine ( public void method1() { print("George 1 "); public class Jerry { public void method10) { print("Jerry 1 "); public void method20 { print("Jerry 2 "); public String toString() { return "Jerry": public class Elaine extends Kramer public String toString() { return "Elaine " + super.toString(); public class Kramer extends Jerry public void method1() { super.method1(); print ("Kramer 1"); public...

  • 2. Identify whether the following statements are TRUE or FALSE: (a) Subtyping supports code reuse from...

    2. Identify whether the following statements are TRUE or FALSE: (a) Subtyping supports code reuse from one class, inside of another class. (b) Subclasses depend only on the public interfaces of objects, not their implementations. (c) Interfaces contain fully defined methods and can extend other classes. (d) If B is a subclass of A, then a variable of type A can refer to either an object of type A or an object of type B.

  • This is a question about Java abstract classes. The correct answer is E and I do...

    This is a question about Java abstract classes. The correct answer is E and I do not understand why. Please be specific! I am a beginner in Java abstract classes and methods... 13.6 What is the output of running class Test? public class Test {   public static void main(String[] args) {     new Circle9();   } } public abstract class GeometricObject {   protected GeometricObject() {     System.out.print("A");   }   protected GeometricObject(String color, boolean filled) {     System.out.print("B");   } } public class Circle9 extends GeometricObject {...

  • a. Mention the appropriate relationship between following classes: [0.5 Marks] 1. HOD–StaffMember 2. Car–Ferrari 3. Student-Address...

    a. Mention the appropriate relationship between following classes: [0.5 Marks] 1. HOD–StaffMember 2. Car–Ferrari 3. Student-Address 4. BankAccount–FixedAccount 5. House-Building 6. Department-Teacher 7. Traffic–TrafficSign b. Provide the UML diagram for the following program. [ 0.5 Marks] class Parent { public void getBike() { System.out.println("Suzuki Bike"); } } class Child extends Parent { public void getCar() { System.out.println("Swift car"); } } class inheritance { public static void main(String args[]) { Parent p = new Parent(); p.getBike(); Child c = new Child();...

  • Question 11     The feature that enables you to split source code between two or more...

    Question 11     The feature that enables you to split source code between two or more files is: Select one: a. base class b. partial classes c. generics d. dynamic link library e. package Question 12     Packaging data attributes and behaviors into a single unit so that the implementation details can be hidden describes an object-oriented feature called: Select one: a. abstraction b. objects c. inheritance d. polymorphism e. encapsulation Question 13     A multitier application would probably have:...

  • 1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer...

    1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer >(); ArrayList b = a; a.add(new Integer(4)); b.add(new Integer(5)); a.add(new Integer(6)); a.add(new Integer(7)); System.out.println(b.size()); A)1 B)2 C)3 D)4 E)5 2. Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Person class. Consider the following code:     Person p1, p2, p3;     int m1, m2, m3;     p1 = new Person();     m1 = p1.getMoney();     // assignment 1...

  • Part 1 of 1 Question 1 of 5 2Points Constant types defined under classes need to...

    Part 1 of 1 Question 1 of 5 2Points Constant types defined under classes need to be encapsulated. True False Reset Selection Question 2 of 5 2Points A user defined Java class usually is meant to be a template. True False Reset Selection Question 3 of 5 2Points Which of the following statements should be used to declare a variable under a Java class? O A. String name; OB. public int age; C. public static double PI; D. private char...

  • Question 8 0 Consider the following class definitions, public class Class public String getValue() return "A";...

    Question 8 0 Consider the following class definitions, public class Class public String getValue() return "A"; public void showValue() System.out.print(getValue(); public class Classe extends Class public String getValue() return "B"; The following code segment appears in a class other than ClassA or Classe. ClassA obj = new Class(); obj.showValue(); What, if anything, is printed when the code segment is executed? c) AB ta PendulumPhysical.pdf ^ IN SHM Pendulums ....doc Moh PendulumPhysical.pdf Type here to search o Bi e а в...

  • 5 The following two classes are related by inheritance. Fill in the three (3) blanks as...

    5 The following two classes are related by inheritance. Fill in the three (3) blanks as follows: (a and b) initialize the instance variable "name," (c) calculate a the current pay for a special employee who is paid a portion of their salary plus a bonus each pay period. (Note that the code may not illustrate all class methods.) public class Employee private String name; private double salary; public Employee(String name) public double pay) return salary /24 public class SpecialEmployee...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT