Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code has to be in Python. You do not have to include the extra credit portion. In this project students vill build a scientific calculator

Code has to be in Python. You do not have to include the extra credit portion.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
In this project students vill build a scientific calculator on the command line. The program will display a menu of options vhich includes several arithmetic operations as well as options to clear the resull, display statistics. and exit the program. The project is designed to give students an opportunity to practice looping, type conversion, and data persistence. Specification When the program starts it should display a menu, prompt the user to enter a menu option, and read a value: Current Result: 0.0 Calculator Menu 0. Exit progran 1. Addition 2. Subtraction 3. Mu1t1pi1cation 4. Diviston 5. Exponentiation 6. Logartth 7. Dtsplay Average Enter Menu Selectiont 1 Enter first cperend: be.t. Operational Behavior This calculator includes multiple behaviors that are unique depending on the input and operation specified; they are detailed in this section. Exponentiation For exponentiation, the first operand should be used as the base and the second as the exponent, i.e: If the first operand is 2 and the second is 4.24=16 Logarithm For logarithms, the first operand should be used as the base and the second as the yleld, L.e.: If the first operand is 2 and the second is 4log24=2 (Hint Use python math tbrary) Displaying the Averege As the program progresses, a should store the total of all resilts of calculation and the number of Nole that this does not include the staring vilue of of The propram chould display the averege of : calculations as followns: Sun of calculations: 102.3 Number of calculations: 2 Averaoe of calculations: 50.15 Note that the average calculation should show a maximum of two decimal places The program should immediately prompt the user for the next menu option (without redisplaying the menu). If no calculations have been performed, this message should be displayed Error: no calculations yet to average! Extra Credit Using Results of Calculation You can earn 5% extra credit on this project by allowing the user to use the previous result in an operation. To add this feature, allow the user to enter the word "RESULT" in place of an operand; if the user does so, the program should replace this operand with the result of the previous calculation (or zero if this is the first calculation): Enter first operand: 89.1 Enter second operand: RESULT ) Submlssions NOTE: Your output must match the eximpls oulpit "exacty". If it does not, you will not recelve full credit for your submisibiont File: scl_calculator.py Method: Submit on Zylebs Do not eubmit eny other fied Eurrent Result: 0.0 Calculator Menu 0. Exit program 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Exponentiation 6. Logarithin 7. Display Average Enter Menu Selection: 7 Error: No calculations yet to averaget Enter Menu Selection: 1 Enter furst operand: 0.5 Enter second operandt 2.5 current kesultet 2,0 caiculator Venu 0. Exit Programt 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Exponentiation 6. Logarithm 7. Display Average Enter Menu Selection: 5 Enter first operand: 2.0 Enter second operand: 2.0 Current Result: 0.25 Calculator Menu 0. Exit program 1. Addition 2. Subtraction 3. Multipiication 4. Division 5. Exponentiation 6. Logartthm 7. Disolay A.erage Enter MenL Selection: 6 Enter first operand: 2 Enter second operand: 0.5 Current Result: 1.0 Calculator Menu: 0. Exit Program 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Exponentation 6. Logarithin 7. Display Averese Enken Menu seiection: sum of calculatfons: -2.75 Muber of catculations:/3 Average of calculaetons: 0.92 Enter" MenL Se7ection: 10 Error: Invalid selection! Enter Menu Selection: 0 Thanks for using this calculator. Goodbye

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_2

Step: 3

blur-text-image_3

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions