Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a class called QuizProgram that simulates a quiz that helps a young child practice addition and subtraction. The program randomly computes 10 quiz questions

image text in transcribed

Write a class called QuizProgram that simulates a quiz that helps a young child practice addition and subtraction. The program randomly computes 10 quiz questions which are either addition or subtraction questions in the form of N1 - N2 or N1 N2-, where the user types in the guessed answer to the math expression. N1 should be a number from 0 to 99 and N2 should be a number from 0 to N1. The decision to use an addition or subtraction operator in the question should be chosen randomly as well, with equal probability. If the user types in the correct answer, the program should say "You are correct!", otherwise it should print "Sorry, the correct answer is__". After the 10 questions have been asked, the program should show the % of correct answers Here is example output (colors added for emphasis only): What is the answer to 3 + 0 = 3 You are correct! What is the answer to 22-11 = 11 You are correct! What is the answer to 17-13-4 You are correct! What is the answer to 93 + 21 = 5 Sorry, the correct answer is 114 What is the answer to 70 12 82 You are correct! What is the answer to 88-43 = 12 Sorry, the correct answer is 45 What is the answer to 8842130 You are correct! What is the answer to 94 -5935 You are correct! What is the answer to 91+ 62 153 You are correct! What is the answer to 68-20 = 48 You are correct! You scored 80% on the quiz

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago