We are going to continue exploring functions and subroutines by writing a program that administers a hexadecimal addition quiz. The quiz will have ten questions and your program must keep track of the user’s answers.
We will also get more practice using Eclipse to make our programming life easier.
This assignment also exposes you to hexadecimal numbers. Hexadecimal numbers are base 16 numbers. The digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
This is where we will put all our classes for homework 06.
Write a program that administers a basic hexadecimal addition quiz to the user. There should be ten questions. Each question is a simple addition problem such as “2C + 12 = “, where the numbers are hexadecimal (the answer is 3E). The numbers in the problem are chosen at random (and are not too big, < 100). The program should ask the user all ten questions and get the user’s answers. The user will answer in hexadecimal numbers. After asking all the questions, the program should print each question again, with the user’s answer. If the user got the answer right, the program should say so; if not, the program should give the correct answer. At the end, tell the user their score on the quiz, where each correct answer counts for ten points.
You can use as many subroutines as you want. I suggest at least four subroutines, one to create the quiz, one to administer the quiz, one to convert the user’s answers to ints, and one to grade the quiz. It can use three arrays, with three global variables of type int[ ], to refer to the arrays. The first array holds the first number from every question, the second holds the second number from every questions, and the third holds the user’s answers.
Hint: You can output hexadecimal values by using the following:
Criterion | Excellent (100%) | Satisfactory (75%) | Borderline (50%) | Unsatisfactory (25%) | Poor (0) |
---|---|---|---|---|---|
Adherence to standards - 2 points Does it conform to standards in every detail? |
No errors. | Minor details of the assignment are violated, or poor choices are made where the assignment is unclear. | Significant details of the assignment or the underlying program intent are violated, but the program still fulfills essential functions. | Significant details of the assignment or the underlying program intent are violated, but the program still fulfills some essential functions. | Misses the point of the assignment. |
Breakdown (modular design) - 2 points Does it demonstrate good modular design? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
Correctness of code - 4 points Does it work? Does it pass JUnit? |
Passes all tests. | Works for typical input, may fail for minor special cases. | Fails for typical input, for a minor reason. | Fails for typical input, for a major reason. | No. |
Documentation, and style - 2 points Is it clear and maintainable? Does it pass CheckStyle? |
No errors. | 1-3 minor errors. | > 3 minor errors OR 1 major error. | 2 major errors | > 2 major error. |
The assignment is due on Friday, October 8th at 11:55pm. You may turn it in early.
Conduct a personal review of your code before turning it in. Does your code follow the Java Coding Standard?
Test your code.
Export your ICS111-workspace project by choosing File -> Export. Name the zip file H06.zip.
Sign into Laulima, then navigate to the ICS111 site. In the left hand side of the site, there is an Assignments tab/link. Click on it and view all of the posted assignments. Select the assignment that you want to turn in and attach your H06.zip file and accept the honor pledge to submit the assignment.