Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

1. Complete an algorithm, code and compile the following program. Save the program as mathTutor.py.

Math Tutor

You will be creating a math tutor program that can be used for young children to practice their math skills.  The program will be driven by the following menu:

  1. See Rules
  2. Practice Math
  3. Exit

If the user chooses (1) from the menu, the following rules will be displayed:

This program will help you practice your math skills. 

First, you will choose Addition, Subtraction or Multiplication.  Next, you will choose a level.  Level 1 will give you problems with single digits and Level 2 will use two-digit numbers. Then, you will choose how many math problems you would like to complete.  After you have completed all your problems, you will be given a score.

You can play as many times as you want.  Have fun!!

If the user chooses (2) from the menu:

  • First, prompt from the following math operation menu:
  1. Addition
  2. Subtraction
  3. Multiplication
  • Next, prompt from the following level menu:
  1. Level One
  2. Level Two
  • Next, prompt for the number of math problems to complete.
  • Next, use a loop to do the following for each problem:
    • Level One – generate two random numbers from 1 – 9
      Level Two – generate two random numbers from 1 – 99

      Notes : To generate random numbers, use the randint() function from the random Python Library 
                      See attached coin.py sample program for more information on how to generate random numbers

    • Show the math problem that corresponds with the operation that the user chose.

      Note: If the user chose Subtraction, make sure that the larger number comes first.

    • Prompt the user for the correct answer.
    • Calculate the correct answer.
    • Compare the user’s answer with the correct answer and display whether or not the user answered correctly. 
      Keep track of how many the user answers correctly.

  • After all problems are complete, display the number correct and the percent correct.

If the user chooses (3) from the menu, display a good bye message.

The users can play the game as many times as they wish, until they choose (3) to Exit. 

Program must include:

>> Documentation at the top indicating

Filename
Name of programmer
Program description
Algorithm (using pseudocode)

>> Comments throughout the code documenting the main steps described in the algorithm.

>> See attached sample project output as a guideline.

Input Validation:

Validate that all menu choices are valid.
Validate that the number of problems the user enters is positive.

Functions:

Include at least three functions of your choice (in addition to main) .

2. Upload algorithm and your source code (.py file) to this assignment for grading

Please choose from the following menu:
1) See rules
2) Math Practice
3) Exit
Enter your choice here: 2
You have chosen to do some math!!
Please choose from the following menu:
1) Addition
2) Subtraction
3) Multiplication
Enter your choice here: 1
Next, choose a level,
1) Level One
2) Level Two
Enter your level choice here: 3
Invalid input. You must choose 1 or 2 from the menu.
Enter your choice here: 3
Next, choose a level,
1) Level One
2) Level Two
Enter your level choice here: 1
Enter how many problems you would like to try: 2
Problem 1:
2x7=? 14
Correct! Great job!
Problem 2:
2x1=?2
Correct! Great job!
You answered 2 out of 2 correctly. Your score = 100%
expand button
Transcribed Image Text:Please choose from the following menu: 1) See rules 2) Math Practice 3) Exit Enter your choice here: 2 You have chosen to do some math!! Please choose from the following menu: 1) Addition 2) Subtraction 3) Multiplication Enter your choice here: 1 Next, choose a level, 1) Level One 2) Level Two Enter your level choice here: 3 Invalid input. You must choose 1 or 2 from the menu. Enter your choice here: 3 Next, choose a level, 1) Level One 2) Level Two Enter your level choice here: 1 Enter how many problems you would like to try: 2 Problem 1: 2x7=? 14 Correct! Great job! Problem 2: 2x1=?2 Correct! Great job! You answered 2 out of 2 correctly. Your score = 100%
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education