Difference: CSC121F2023Lab07 (2 vs. 3)

Revision 32023-10-04 - CathyBareiss

Line: 1 to 1
 
META TOPICPARENT name="CSC121SylF2023"
Changed:
<
<

Methods 2: Inventory control with files: Fall 2023

>
>

Exceptions: Quiz program using exceptions: Fall 2023

 

Learning Objective(s)

  1. Continue to improve methods
  2. Continue to work with files
  3. Become more confident in programming skills
  4. Simple exception handling

Overview of the Program

Changed:
<
<
Create a program To give multiple choice quizzes to the user.
>
>
Create a program to give multiple choice quizzes to the user.
 

Specifics

  • The program should be called Quizzer
  • There should be at least two constants:
Line: 18 to 18
 
    • For each quiz, there are a number of multiple questions with 4 possible answers each.
    • For each quiz, the program should inform how many questions were answered and how many were answered correctly.
  • The only I/O allowed in the main method should be to get the name of the file containing the next quiz (along with the associated prompt)
Changed:
<
<
  • You should have one method that will process a an entire quiz. The only I/O it should do is to open and close the file and report on the entire quiz.
>
>
  • You should have one method that will process an entire quiz. The only I/O it should do is to open and close the file and report on the entire quiz.
 
  • You should have a method that asks one question. It asks the question (including giving the possible answers), gets the answer from the user, reports to the user if it is correct and returns that status.
Changed:
<
<
  • You should have another method that ensures that the user only inputs a, b, c, or d. It should return what it inputs
>
>
  • You should have another method that ensures that the user only inputs a, b, c, or d. It should return what was inputted correctly.
 

Sample dialogue

Below is a sample dialogue. Your output can vary somewhat as long as the required data is nicely displayed

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback