Question: Lab # 8 - Inheritance Objectives: In this lab, the following topic will be covered: 1. Inheritance Task Create a class called Question that contains

Lab \# 8 - Inheritance Objectives: In this lab, the following topic will be covered: 1. Inheritance Task Create a class called Question that contains one private field for the question's text. Provide a single argument constructor. Override the toString() method to return the text. Create a subclass of Question called MCQuestion that contains additional fields choices and answer. Provide a suitable constructor. Override the toString() method to return all data fields (use the toString() method of the Question class). Write a test program that creates a MCQuestion object with values of your choice. Print the object using the toString method. Here is a sample run of the program: Question: Variables that are shared by every instance of a class are: a. public variables b. private variables c. instance variables d. class variables answer: d
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
