Tags:
tag this topic
create new tag
view all tags
---+ Nested Loops Lab: Quiz: Fall 2024 ---++ Learning Objective(s) * Implement nested loops * Work with a sequential text file * Implement exceptions ---++ Overview of the Program Write a program to give a quiz ---++ Specifics * The program is to be called *Quiz* * Get it to work correctly using "throws exception" before catching them. The final version must catch exceptions. * The user is to input the name of the file that contains the quiz. * Your program must work with the sample quiz in the lab folder * The program should output the number of questions asked and the number of questions answered correctly. * 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. * There should be one constant for the number of possible answers to a give question. (Every question in a given file will have the same number of possible answers.) * 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>What is the name of the quiz (i.e. the file)? <b><font color='blue'>samplequiz</font></b> Question: What color is the sky? A: blue B: yellow C: black D: grey Answer? <b><font color='blue'>A</font></b> Correct. Question: What is 2 + 2? A: 1 B: 2 C: 3 D: 4 Answer? <b><font color='blue'>B</font></b> Wrong. The answer was D. You got 1 out of 2 questions. </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: Dealing with exceptions: see class examples * Hint 3: If you have trouble opening the file, make sure that file is in the same folder as the program is and you are in that folder in !JGrasp ---++ Submission * Create a software development report * For the system design, you may use my flowchart if it is the design of your program. Otherwise, you need to make your own. * 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 * Once again, the expected output cannot be a cut/paste from the running of your program * 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 file name 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-11
-
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