Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

You are required to design and implement a "Maths Test" program that generates simple maths questions, presents them one at a time to the user, and prompts them to enter the answer. The program determines whether the answer is correct and keeps track of data in order to present statistics and a grade to the user once a certain number of questions have been answered.

Despite the similar sounding theme, this program has very little in common with the case study in

Module 5. The case study program involved generating tests to be printed, while this assignment requires an interactive program that administers the test - prompting the user for an answer to each question it generates.

Implement all of the following requirements, and ask your tutor if you do not understand any of the requirements or would like further information. The requirements of the program are:

1. The program should welcome the user and prompt them to choose Easy, Medium or Hard:2. Re-prompt the user until a valid response (1, 2 or 3) is entered. Once a difficulty has been chosen, print a message to confirm the selected difficulty and set variables as follows:

  •  If "Easy" was chosen... lives = 3 and maxNum = 10
  •  If "Medium" was chosen... lives = 2 and maxNum = 25
  •  If "Hard" was chosen... lives = 1 and maxNum = 50

The lives variable determines how many questions the user can get wrong before the test ends, and the maxNum variable determines the biggest number that can be generated in a question. 3. The program should then enter a loop that will be used to ask 10 questions. The loop body code must generate and display a question, prompt for and check the answer, and display feedback:

3.1. Write a function named "generateQuestion" which requires a parameter of the maxNum variable. The function should generate two random numbers between 1 and maxNum, and then randomly choose between the addition ("+") or subtraction ("-") operator. Concatenate the numbers and operator into a string (e.g. "What is 20 + 25?") and also calculate the answer to the question (e.g. 45). The function should return both the question string and the answer (an integer).

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91605603

Have any Question?


Related Questions in Computer Engineering

Two contract offers are made to you the first contract

Two contract offers are made to you. The first contract offers $10,000 at the end of each year for the next five years and then $20,000 per year for the following 10 years. The second offer pays 10 payments, starting wit ...

As a wealthy graduate of the university you have decided to

As a wealthy graduate of the University, you have decided to give back to the University in the form of a scholarship. You have decided to donate a one-time gift of $500,000 that will be invested at a rate of 5.5% per ye ...

Two people agree to meet at a coffee shop they each

Two people agree to meet at a coffee shop. They each independently pick a random moment in time between 8 a.m. and 9 a.m. and show up exactly at their selected time. But they are very impatient, and only stay for 10 minu ...

Suppose a bowl has 5 chips 2 chips labeled 2 and 3 chips

Suppose a bowl has 5 chips; 2 chips labeled "2" and 3 chips labeled "3". Suppose 2 chips are selected at random without replacement. Let random variable X equal the product of the two draws (e.g. if the first draw is a 2 ...

Java program that prompts the user to enter the base and

Java program that prompts the user to enter the base and slant height for a regular pyramid shape, then calculates and outputs its volume and surface area. A and B are requirements A It is required to use JOptionPane's I ...

An array a1 n is said to have a majority element if more

An array A[1 . . . n] is said to have a majority element if more than half of its entries are the same. Given an array, the task is to design an efficient algorithm to tell whether the array has a majority element, and, ...

When you respond to others discuss ways in which technology

When you respond to others, discuss ways in which technology has changed your outlook on your career of choice.

Identify at least two 2 factors that have led to the

Identify at least two (2) factors that have led to the explosive growth of digital crime over the past a few decades. Next, describe the most common forms of digital crime, and give your opinion as to why those forms you ...

A mining company wishes to start up a new small gold mine

A mining company wishes to start up a new small gold mine. The initial cost will be $5m and it is expected to extract $3m a year in gold with incurring only $1.5m a year in costs for 5 years. Assume revenue and costs are ...

Question explain the difference between physical network

Question: Explain the difference between physical network segmentation and microsegmentation as they relate to cloud security. Explain what it means to implement a zero trust security strategy. Explain how microsegmentat ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As