Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem #2: Custom Number Game You are creating a math game that uses a user-inputted number to provide custom math questions Create a integer variable

image text in transcribedimage text in transcribed

Problem #2: Custom Number Game You are creating a math game that uses a user-inputted number to provide custom math questions Create a integer variable that stores the number of correct answers. . Greet the user and ask them to input a number. Ensure that this value is an integer, Ask the user five questions: Question 1: User's Number +7 Question 2: User's Number - 5 Question 3: User's Number * 3 Question 4: User's Number / 2.0 Question 5: User's Number % 2 . For cach question: If the user answers the question correctly: Tell the user they got the answer correct and add one to the number of correct answers. . If the user answers the question incorrectly: Tell the user they got the answer incorrect. Report the number of correct answers the user got. Then provide an extra message: . If the user got all five questions correct, tell the user, "A perfect score! Great work." Else, if the user got none of the questions correct, tell the user, "You need to work on your math. Better luck next time!" Else, tell the user, "Not bad! Try again some time!" Here are a few sample runnings of your program, with user input bolded: Run #1 Welcome to the Custom Number Game! Please enter an integer: 10 Question 1: What is 10 + 72 17 Correct! Question 2: What is 10 - 5? 5 Correct! Question 3: What is 10 * 3? 30 Correct! Question 4: What is 10 / 2.0? 5 Correct! Question 5: What is 10 22 Correct! You answered 5 out of 5 questions correctly. A perfect score! Great work. Run #2 2,34 Welcome to the Custom Number Game! Please enter an integer: 27 Question 1: What is 27 + 72 34 Correct! Question 2: What is 27 - 5? 22 Correct! Question 3: What is 27 * 37 60 Incorrect! Question 4: What is 27 / 2.0? 13.5 Correct! Question 5: What is 27 & 22 1 Correct! You answered 4 out of 5 questions correctly. Not bad! Try again some time! Run #3 Welcome to the Custom Number Game! Please enter an integer: 535324 Question 1: What is 535324 + 7? 213 Incorrect! Question 2: What is 535324 - 5? 124 Incorrect! Question 3: What is 535324 * 3? 76875 Incorrect! Question 4: What is 535324 / 2.0? 3241 Incorrect! Question 5: What is 535324 % 2? 3245 Incorrect! You answered 0 out of 5 questions correctly. You need to work on your math. Better luck next time

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

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions