An examination consists of one or more examination items. Each of the examination items can be of different types (e.g., true or false, multiple choice, enumeration, etc.). All items are associated with the number of points that correspond to the item. Consider the code provided below that includes type declarations for ExamItem, TrueOrFalse, and MultipleChoice, as well as a method administerExam(), that, when invoked, supposedly administers an examination to the user. Complete the given code below. Please answer the question: What must be placed for item/s labeled as #10?

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

An examination consists of one or more examination items. Each of the examination items can be of different types (e.g., true or false, multiple choice, enumeration, etc.). All items are associated with the number of points that correspond to the item. Consider the code provided below that includes type declarations for ExamItem, TrueOrFalse, and MultipleChoice, as well as a method administerExam(), that, when invoked, supposedly administers an examination to the user. Complete the given code below.

Please answer the question: What must be placed for item/s labeled as #10?

void administerExam(String examFile) {
// readExamItems() is used to retrieve the list of examination items from a file...
ExamItem[] items - readExamItems(examFile);
int totalPoints = 0, totalScore = 0;
for (#01 item : #02 ) {
totalPoints += item. #03 ;
item.display();
item.getAnswerFromUser();
totalScore - item. #04 ;
System.out.printf(“You got ×d out of xd points.", totalScore, totalPoints);
#85 class ExamItem {
private int points;
public int getItemPoints() {
return points;
public #05 void display();
public #05 void getânswerFromUser ();
public #05 int checkAnswer ();
#06 TrueorFalse extends ExamItem {
public void #08 { /* method code goes here.. */ }
public void #09 { /* method code goes here.. */ }
public int #10 { /* nethod code goes here.. */ }
class Multiplechoice #87 ExamItem {
public void #08 { /* method code goes here.. */ }
public void #09 { /* method code goes here.. */ }
public int
#10 { /* method code goes here.. */ }
Transcribed Image Text:void administerExam(String examFile) { // readExamItems() is used to retrieve the list of examination items from a file... ExamItem[] items - readExamItems(examFile); int totalPoints = 0, totalScore = 0; for (#01 item : #02 ) { totalPoints += item. #03 ; item.display(); item.getAnswerFromUser(); totalScore - item. #04 ; System.out.printf(“You got ×d out of xd points.", totalScore, totalPoints); #85 class ExamItem { private int points; public int getItemPoints() { return points; public #05 void display(); public #05 void getânswerFromUser (); public #05 int checkAnswer (); #06 TrueorFalse extends ExamItem { public void #08 { /* method code goes here.. */ } public void #09 { /* method code goes here.. */ } public int #10 { /* nethod code goes here.. */ } class Multiplechoice #87 ExamItem { public void #08 { /* method code goes here.. */ } public void #09 { /* method code goes here.. */ } public int #10 { /* method code goes here.. */ }
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
void method
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage