Question: Please help with easy first year computer science questions A1 (25 marks) Focus: OOP basics, Inheritance, and Polymorphisnm Q1. [15 marks] Suppose that Fruit, Apple,

Please help with easy first year computer science questions

Please help with easy first year computer science questions A1 (25 marks)

Focus: OOP basics, Inheritance, and Polymorphisnm Q1. [15 marks] Suppose that Fruit,

Apple, Orange, GoldenDelicious, and Mclntosh are defined in the following inheritance hierarchy:

A1 (25 marks) Focus: OOP basics, Inheritance, and Polymorphisnm Q1. [15 marks] Suppose that Fruit, Apple, Orange, GoldenDelicious, and Mclntosh are defined in the following inheritance hierarchy: Fruit Apple Orange + makeAppleCider)void + makeOrangeJuice) void GoldenDelicious Mclntosh And assume that the following code is given: Fruit fruit - new GoldenDelicious) Orange orange = new Orange(); Answer the following questions, and explain your answer. a. Is fruit instanceof Fruit? b. Is fruit instanceof Orange? c. Is fruit instanceof Apple? d. Is fruit instanceof GoldenDelicious? e. Is fruit instanceof McIntosh? f. Is orange instanceof Orange? g. Is orange instanceof Fruit? h. Is orange instanceof Apple? i. Can fruit invoke makeAppleCider method? j. Can orange invoke makeAppleCider method? k. Can fruit invoke makeOrangeJuice method? I. Can orange invoke makeOrangeJuice method? m. Is the statement Orange p = new Apple() legal? Is the statement McIntosh p = new Apple() legal? Is the statement Apple p = new McIntosh() legal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!