Write a program that will simulate a simple calculator. There will be four options: add two numbers, subtract two numbers, square root and raise to the power. During the subtraction option, you should not get any negative numbers when subtracting. For example, if we subtract 4 -7 you should get 3 not negative 3. Tip: use the absolute value function. You will use a switch case statement to create the selection mechanism. You will use three predefined functions we have used from chapter 4. The program will loop as long as the user types in Y or y for yes. You must include comments, failure to do so will vastly affect your grade. Once you are done, submit in a .cpp file. You do not need to show me the running program. I will check to see that it runs as l am grading your lab. Select a an option (1-4) from the following 2. subtraction of two positive numbers 1. Addition of two number 3. Square root of a number 4. Raise to the power 1 You chose to add two number Enter the first number 2 Enter the second number The addition of the two numbers is 4 Do you want to run this program again? This program functions as a small calculator Select a an option (1-4) from the following 1. Addition of two number 2. subtraction of two positive numbers 3. Square root of a number 4. Raise to the power You chose 2 to subtract two positive numbers Enter the first number 4 Enter the second number 5 The subtraction of these two numbers is Do you want to run this program again?
Write a program that will simulate a simple calculator. There will be four options: add two numbers, subtract two numbers, square root and raise to the power. During the subtraction option, you should not get any negative numbers when subtracting. For example, if we subtract 4 -7 you should get 3 not negative 3. Tip: use the absolute value function. You will use a switch case statement to create the selection mechanism. You will use three predefined functions we have used from chapter 4. The program will loop as long as the user types in Y or y for yes. You must include comments, failure to do so will vastly affect your grade. Once you are done, submit in a .cpp file. You do not need to show me the running program. I will check to see that it runs as l am grading your lab. Select a an option (1-4) from the following 2. subtraction of two positive numbers 1. Addition of two number 3. Square root of a number 4. Raise to the power 1 You chose to add two number Enter the first number 2 Enter the second number The addition of the two numbers is 4 Do you want to run this program again? This program functions as a small calculator Select a an option (1-4) from the following 1. Addition of two number 2. subtraction of two positive numbers 3. Square root of a number 4. Raise to the power You chose 2 to subtract two positive numbers Enter the first number 4 Enter the second number 5 The subtraction of these two numbers is Do you want to run this program again?
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
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education