Tags:
tag this topic
create new tag
view all tags
---+ Nested Loops Lab: Quiz: Fall 2024 ---++ Learning Objective(s) * Improve skill with arrays * Work with 2d arrays ---++ Overview of the Program Adapt lab 5 (the quiz program) to use arrays and to continue to ask questions (in a random order) until all are answered correctly ---++ Specifics * The program is to be called *Quiz* * You may use the posted solution to lab 5 if you wish (be sure to indicate that in "Outside Resources" * Load the data into arrays (one array for the question, a 2D array for the possible answers, and an array for the correct answer) one time * Use constants for the maximum number of questions and for the exact number of possible answers * Use a constant for the name of the file containing the first quiz. * Catch all IO Exceptions * Allow the user to do multiple quizzes. * The user is to input the name of the file that contains the quiz. * Output the statistics at the end of each quiz * After each question, the program should inform the user if he/she answered it correctly. * You must have one event controlled loop and one count controlled loop. * Be sure to close the file. ---++ Sample dialogue Below is a sample dialogue. Your output can vary somewhat as long as the required data is nicely displayed. <pre> Question: What is 2 + 2? A) 1 B) 2 C) 3 D) 4 Answer? <b><font color='blue'>D</b></font> You were correct. Question: What color is the sky? A) blue B) yellow C) black D) grey Answer? <b><font color='blue'>A</b></font> You were correct. There were 2 in the quiz. You took 2 answers to get them all right. That means you scored 100.00 percent. Again? <b><font color='blue'>yes</b></font> Name of next quiz file? <b><font color='blue'>simplequiz.txt</b></font> Question: What color is the sky? A) blue B) yellow C) black D) grey Answer? <b><font color='blue'>A</b></font> You were correct. Question: What is 2 + 2? A) 1 B) 2 C) 3 D) 4 Answer? <b><font color='blue'>B</b></font> You were wrong. Question: What is 2 + 2? A) 1 B) 2 C) 3 D) 4 Answer? <b><font color='blue'>D</b></font> You were correct. There were 2 in the quiz. You took 3 answers to get them all right. That means you scored 66.67 percent. Again? <b><font color='blue'>no</b></font> </pre> You can also run a solution for this program if you want. See classroom instructions for more details. ---++ Lab Hints * Hint 1: [[%ATTACHURL%/QuizFC.pdf][A flowchart for the problem]] * Hint 2: [[CSC121F2024Lab10Hint2][Repeating questions until correct]] * Hint 3: Consider using a <b>do ... while</b> loop in the main method ---++ Submission * Create a software development report * For the system design, you may use my flowchart if it is the design of your program. It is incomplete. You will need to finish it * For testing report, * adapt the testing form so that the input column could also include instructions to the tester * test your loops well: a. Test for different number of questions a. Test for a different number of answers a. Test for different %'s of number correct * Include the details of one data file. You can just describe the rest * For the improvement section, specify how many points were lost from the last lab that you should not lose points for on this lab because you corrected the problem * create a pdf document from your software development report * create an empty zip folder * place *only* !Quiz.java and your pdf document into it * submit the zip folder on canvas ---++ Optional improvements Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor. 1 Get the first file name (or all file names) from command line arguments. This you must research on your own. There will be no help from any lab assistant or instructor or any other live human being to do this. Be sure to document the outside resource if you do this option 1 Allow for the user to use upper or lower case when given their answer 1 Save the program as *QuizExtra.java* and include it in the zip folder
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2024-06-14
-
CathyBareiss
Home
Site map
Assessment web
BethelAIResources2026 web
CenterForComputing web
ChatGPT web
Intro2AIatBethel web
Main web
Sandbox web
TWiki web
CenterForComputing Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
P
P
P
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
Account
Log In
Register User
E
dit
A
ttach
Copyright © 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