Create an interface OnlineQuiz with the following details: Member variables: totalMarks=10 Member Methods: · nQuestions(): An abstract method that calculates and return the number of questions. Defined in subclass. · display(): An abstract method that displays all details. Defined in a subclass

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question
1. Create an interface OnlineQuiz with the following details: Member variables: totalMarks=10 Member Methods: · nQuestions(): An abstract method that calculates and return the number of questions. Defined in subclass. · display(): An abstract method that displays all details. Defined in a subclass. 2. Create a class Staff that inherits OnlineQuiz with the following details: Member variables: · staffD // id of the staff string type · staffName // Name of the staff string type · nMCQ // Number of MCQ type questions int type · nTF // Number of true/false type questions int type · nMatch // Number of match type questions int type Member Methods: · Define the parameterized constructor to set the member variables. · Define the method nQuestions(): which calculate and return the total number of questions. Total number of question= nMCQ + nTF + nMatch · Define the method marksMCQs() which find and returns the marks of MCQs type as given below: Condition Marks of MCQs nTF=4 and nTF=2 totalMarks-6 nTF=4 and nTF=3 totalMarks-3 Otherwise 5 · Define the method display() which display all details including total marks and grade of the student. 3. Create a Driver class to execute the above class construction with the following details: · Create an object of Student class. Use given sample input for your construction: Staff("e123","Said Salim",4,3,3) · Display the Total marks.
1.
Create an interface OnlineQuiz with the following details:
Member variables:
totalMarks=10
Member Methods:
nQuestions0: An abstract method that calculates and return the number of questions. Defined in subclass.
display(): An abstract method that displays all details. Defined in a subclass.
2.
Create a class Staff that inherits OnlineQuiz with the following details:
Member variables:
staffD
staffName
NMCQ
nTF
// id of the staff string type
// Name of the staff string type
// Number of MCQ type questions int type
// Number of true/false type questions int type
// Number of match type questions int type
nMatch
Member Methods:
Define the parameterized constructor to set the member variables.
Define the method nQuestions0: which calculate and return the total number of questions.
Total number of question= nMCQ + nTF + nMatch
Define the method marksMCQs() which find and returns the marks of MCQ type as given below:
Condition
Marks of MCQS
hTF=4 and nTF=2
totalMarks-6
totalMarks-3
hTF=4 and nTF=3
Otherwise
5
Define the method display) which display all details including total marks and grade of the student.
3.
Create a Driver class to execute the above class construction with the following details:
Create an object of Student class. Use given sample input for your construction:
Staff("e123","Said Salim",4,3.3)
Display the Total marks.
Transcribed Image Text:1. Create an interface OnlineQuiz with the following details: Member variables: totalMarks=10 Member Methods: nQuestions0: An abstract method that calculates and return the number of questions. Defined in subclass. display(): An abstract method that displays all details. Defined in a subclass. 2. Create a class Staff that inherits OnlineQuiz with the following details: Member variables: staffD staffName NMCQ nTF // id of the staff string type // Name of the staff string type // Number of MCQ type questions int type // Number of true/false type questions int type // Number of match type questions int type nMatch Member Methods: Define the parameterized constructor to set the member variables. Define the method nQuestions0: which calculate and return the total number of questions. Total number of question= nMCQ + nTF + nMatch Define the method marksMCQs() which find and returns the marks of MCQ type as given below: Condition Marks of MCQS hTF=4 and nTF=2 totalMarks-6 totalMarks-3 hTF=4 and nTF=3 Otherwise 5 Define the method display) which display all details including total marks and grade of the student. 3. Create a Driver class to execute the above class construction with the following details: Create an object of Student class. Use given sample input for your construction: Staff("e123","Said Salim",4,3.3) Display the Total marks.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
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,