Homework 2
Designing with Classes; Using ArrayList

Due: Tuesday, March 31 at 5pm

Outcomes

After successfully completing this assignment, you will...

Before Starting

Read Chapters 2, 3, and 7 in Horstmann.

The Assignment

Write a program that administers an online quiz. A quiz consists of questions. Each question has a (correct) answer and an associated level of difficulty (easy or hard). When the quiz is administered, the program can choose to display all the questions in the quiz, or only those questions at a particular level of difficulty. After the student (user) takes the quiz, the score is reported as a percentage.

NOTE 1: Use the class names and method signatures exactly as given in the following descriptions. We'll be running your code with our own main program that will rely on the given names and signatures. Put each class in its own file. All classes should be part of a package named quizPackage.

NOTE 2: Document all classes and methods with javadoc-style comments.

Data

Methods

Sample Output

A run of the program that shows all questions in the quiz...
<...preparing quiz...>

Type A to see All questions in the quiz
Type E to see only the Easy questions
Type H to see only the Hard questions
Enter your choice (A, E, H) now:  A

An interface can contain method definitions (true/false)
true
No, the answer is false

What keyword is used in Java to indicate that a field is accessible only to objects in its class?
private
Correct!

If a field is private in a superclass, can it be declared public in a subclass (yes/no)
yes
No, the answer is no

Your score is    33.33% 
A run of the program that shows only the easy questions in the quiz...
<...preparing quiz...>

Type A to see All questions in the quiz
Type E to see only the Easy questions
Type H to see only the Hard questions
Enter your choice (A, E, H) now:  E

An interface can contain method definitions (true/false)
false
Correct!

What keyword is used in Java to indicate that a field is accessible by name only to objects in the same class?
public
No, the answer is private

Your score is    50.00% 

Deliverables

Export your Eclipse project to a zip file and submit the zip file via web-based turnin. To export a project, go to File | Export… and choose Archive File from the General folder. Check off the entire project in the top left window and make sure the format is .zip and not .tar. Finally, give the archive file a name and click finish.

The name of the turnin project is Homework 2.

Programs submitted after 5pm on March 31 will be tagged as late, and will be subject to the late homework policy.

Grading

Here is the grade sheet that will be used when grading this assignment (please note that this is the last time the grade sheet will be published in advance). Your program must compile without errors in order to receive any credit. It is suggested that before you submit your program, you should compile it one more time to make sure that it compiles correctly. When grading your program we'll be running our own set of test cases against your classes. Make sure you name your classes and methods exactly as specified.