Java - Math Quiz - Project 03 | CramShark | math quiz |
Java - Math Quiz - Project 03 Solution


You will be writing a Java program from scratch that presents a simple math quiz. This program randomly generates math questions, takes an answer from the user, and computes a final score based on the number of questions correctly answered.
• Practice with programming fundamentals
o Variables - Declaration and Assignment
o Primitive types
o Simple keyboard input and text display output
o Branching: if-else syntax
• Works towards the following Course Goals:
o Competency with using basic coding features of a high-level imperative programming language
o Competency with writing computer programs to implement given simple algorithms
o Familiarity with designing simple text-oriented user interfaces
Project 03 Description
For this lab you will write a Java program that will run a simple math quiz. Your program will generate two random integers between 1 and 20 and then ask a series of math questions. Each question will be evaluated as to whether it is the right or wrong answer. In the end a final score should be reported for the user.

Following the instructions from Closed Lab 01, create a new folder named Project03 and a new Java program in that folder named for this assignment.
Project 03 Sample Ouptut
This is a sample transcript of what your program should do. Items in bold are user input and should not be put on the screen by your program.

Enter your name: Jeremy
Welcome Jeremy! Please answer the following questions:

4 + 6 = 10

4 * 6 = 24

4 / 6 = 1
The correct answer is 0

4 % 6 = 4

You got 3 correct answers
That's 75.0%!

Your code will behave differently based on the random numbers it selects and the answers provided by the user. Here is a second possible execution of this code:

Enter your name: Bob
Welcome Bob! Please answer the following questions:

3 + 3 = 0
The correct answer is 6

3 * 3 = 6
The correct answer is 9

3 / 3 = 0
The correct answer is 1

3 % 3 = 1
The correct answer is 0

You got 0 correct answers
That's 0.0%!

Via CramShark