Java – Question 2: Random Math Quiz Solved

$ 29.99
Category:

Description

In this question, you are asked to write a program to ask randomly-generated mathematic questions to user until s/he enters a wrong answer. Your questions can be summation, substraction or multiplication of two random numbers.
Algorithm:
• (10 points) Generate a mathematical operation randomly.
o For simplicity, you can generate an integer between (1, 3) such that 1 is summation, 2 is substraction and 3 is multiplication.
o Related method (“chooseOperation()”) returns an integer value. So, you should decide which integer means which operation in another method.
• (40 points) Ask randomly generated questions to user until s/he enters a wrong answer.
o Create two random integers between (1, 100). o According to the operation, ask question to user. o Take user’s answer and compare it with correct result.
o If user’s answer is correct, continue the quiz with a new question. Otherwise, terminate the quiz and report total number of correct answers.
You are given “run()” and “welcomeMessage()” methods. You do not need to change this methods. You are expected to fill “chooseOperation(),” “compareResults()” and “askQuestion()” methods.
Implementation Note: If you are %100 sure of your alternative solution, you can change/ignore the code template and write your alternative solution. If your code works without using any funny tricks, you will get full credit. However, if your alternative solution does not work, you will not get partial credit.
Sample Run:

Reviews

There are no reviews yet.

Be the first to review “Java – Question 2: Random Math Quiz Solved”

Your email address will not be published. Required fields are marked *