Methods: Arithmetic Quizzer
Learning Objective(s)
- Reinforce repetition
- Reinforce methods
Overview of the Program
Write a program that will quiz the user about integer arithmetic (esp. about +, -, *, and /)
Details
- The user can specify the smallest and largest number allowed. Negative numbers can be allowed
- The user can specify what operation should be used for all questions
- The user can specify how many questions will be asked
- The system will report back the number correct.
- The system will repeat the quizzing (given the specified output) until the user scores at least a 75%
- Random numbers should be used
- Have one method (appropriately named) that asks one question of the user (such as 7 + 5 =?) and returns the user's answer.
- Have a second method that generates the question, calls the first method to get an answer, and returns if the answer is correct or not
- Have a third method that will quiz the user the set number of times and return how many are correct.
- Program should be called Quizzer
Example program dialogue:
What operation (+, -, *, /)?
+
What is the lowest number you want included?
1
What is the highest number you want included?
5
How many questionsZ
4
What is 2 + 4?
6
You got that correct.
What is 4 + 5?
9
You got that correct.
What is 4 + 1?
5
You got that correct.
What is 1 + 2?
3
You got that correct.
You got 4 right.
Submission
- create an empty zip folder
- place your java file into it
- create a pdf document that contains your Software Development Report for this program and place the pdf file into the zip folder
- submit the zip folder on canvas
Hints
- Program design
- Random numbers
- Method to get the user's answer to one question.
- Method to do an entire question
- Method to do an entire quiz
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. You must score at least 90% on the rest of the program to earn any additional points
- Have defaults that are used. You must come up with a reasonable user dialogue for this.
- Let the user specify the use of a random operator instead of always the same
- Add at least two more operations
- Work with floating point but limit the number of significant digits to 2 places (after the decimal point)