lease do this in Python: TEXT-BASED CALCULATOR PROJECT  OPERATION CONTROLS '+' for addition '-' for subtraction '*' for multiplication '/' for division 'r' or 'R' to find the square, cube, etc. root (entered as an integer) 'x' or 'X' to take to a power of x '(' and ')' to establish order of precedence '=' to perform the calculation entered 'e', 'E', 'q', or 'Q' to exit the Calculato

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please do this in Python:

TEXT-BASED CALCULATOR PROJECT  OPERATION CONTROLS

  • '+' for addition
  • '-' for subtraction
  • '*' for multiplication
  • '/' for division
  • 'r' or 'R' to find the square, cube, etc. root (entered as an integer)
  • 'x' or 'X' to take to a power of x
  • '(' and ')' to establish order of precedence
  • '=' to perform the calculation entered
  • 'e', 'E', 'q', or 'Q' to exit the Calculator

USER EXPERIENCE

  • Must display the message "Welcome to the Text-Based Calculator" when program begins.
  • Must display the message "Thank you for using the Text-Based Calculator" when program exits.
  • Must display the prompt "Input: " to solicit user input.
  • User input must be terminated with an '=' sign.
  • Spaces must be ignored, if present.
  • Operations are performed left-to-right in the order they appear.
  • Must show entire line to be computed along with the result after the '=' sign.
  • Output line must be properly formatted to show spacing between numbers and operators.
  • Integer candidate values must display as integers (i.e. 5.0 displays as 5).
  • Floats must display to the minimum necessary precision (i.e 5.55000 displays as 5.55).
  • Arithmetic errors such as 'divide-by-zero' must be intercepted and reported.
  • Syntax errors such as consecutive operators or invalid terms must be intercepted and reported.

CODE REQUIREMENTS

  • Your code must include at least one private variable.
  • Your code must include at least one function.
  • Your code must include at least one 'while' statement.
  • Your code must include at least one 'for' statement.
  • Your code must include at least one 'if/else' statement.
  • Your code must include at least one 'list' and/or one 'dictionary'.
  • Your code must include at least one 'try/except' block.
  • Your code must not exceed 150 lines in total.

 

 

 

 

PROGRAM EXECUTION EXAMPLE

Welcome to the Text-Based Calculator
 
Input: 2+ 3 *4/ 5+24 =
2 + 3 * 4 / 5 + 24 = 28
Input: 2+(3*4)/5+24=
2 + ( 3 * 4 ) / 5 + 24 = 26.8
Input: Q
 
Thank you for using the Text-Based Calculator
 
ron@Mac ~ %

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 3 images

Blurred answer
Knowledge Booster
Program on Numbers
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education