Create a calculator that can add, subtract, multiply or divide depending upon the input from the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a calculator that can add, subtract, multiply or divide depending upon the input from the user, using loop and conditional statements. After each round of calculation, ask the user if the program should continue, if 'y', run your program again; if 'n', stop and print 'Bye'; otherwise, stop and print 'wrong input'. Sample run 1: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 3 Enter first number: 15 Enter second number: 14 15 * 14 = 210 Do you want to do another calculation (y/n)? n Bye Sample run 2: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 2 Enter first number: 15 Enter second number: 14 1514=1 Do you want to do another calculation (y/n)? y Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Hints: Make an infinite loop with a stopping criterion. Create a calculator that can add, subtract, multiply or divide depending upon the input from the user, using loop and conditional statements. After each round of calculation, ask the user if the program should continue, if 'y', run your program again; if 'n', stop and print 'Bye'; otherwise, stop and print "wrong input'. Sample run 1: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 3 Enter first number: 15 Enter second number: 14 15 * 14 = 210 Do you want to do another calculation (y/n)? n Bye Sample run 2: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 2 Enter first number: 15 Enter second number: 14 1514=1 Do you want to do another calculation (y/n)? y Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Hints: Make an infinite loop with a stopping criterion. Create a calculator that can add, subtract, multiply or divide depending upon the input from the user, using loop and conditional statements. After each round of calculation, ask the user if the program should continue, if 'y', run your program again; if 'n', stop and print 'Bye'; otherwise, stop and print 'wrong input'. Sample run 1: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 3 Enter first number: 15 Enter second number: 14 15 * 14 = 210 Do you want to do another calculation (y/n)? n Bye Sample run 2: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 2 Enter first number: 15 Enter second number: 14 1514=1 Do you want to do another calculation (y/n)? y Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Hints: Make an infinite loop with a stopping criterion. Create a calculator that can add, subtract, multiply or divide depending upon the input from the user, using loop and conditional statements. After each round of calculation, ask the user if the program should continue, if 'y', run your program again; if 'n', stop and print 'Bye'; otherwise, stop and print "wrong input'. Sample run 1: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 3 Enter first number: 15 Enter second number: 14 15 * 14 = 210 Do you want to do another calculation (y/n)? n Bye Sample run 2: Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Enter choice (1/2/3/4): 2 Enter first number: 15 Enter second number: 14 1514=1 Do you want to do another calculation (y/n)? y Select operation: 1. Add 2. Subtract 3. Multiply 4. Divide Hints: Make an infinite loop with a stopping criterion.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions

The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 15. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...

The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1 and 2. On September 1, Irene opened a retail store that specializes in sports car...

What are the four different elements of advertising? Are all of them appropriate to an average retailer in most markets?

(a) Calculate the Knoop hardness when a 500g load yields an indentation diagonal length of 100 m. (b) The measured HK of some material is 200. Compute the applied load if the indentation diagonal...

Given that F=dV/dr, calculate the distance dependence of the force acting between two nonbonded groups of atoms in a polymer chain that have a London dispersion interaction with each other.

Yazaki Corporation and DENSO Corporation are both Japanese companies that supply electrical components to manufacturers of automobiles. Following an investigation by the U.S. Department of Justice in...

Leslie Epstein, an employee of Bormack Manufacturing Company, prepares journal vouchers for general ledger entries. Because of the large number of voided journal vouchers caused by errors, the...

(d) For the following Boolean expression, give: i. The truth table F(a, b, c, d) = ( + b.d).(c.b.a. + .d) ii. The Karnaugh map iii. The minimal sum of products expression

In the given carbon skeleton structure below. identify the carbon atom(s) with sp3 hybradization. H

Selected financial data for Kenny Enterprises follows for a production level of 120,000 units: Total fixed costs $300,000 $450,000 Total costs (fixed and variable) This cost data is applicable for a...

What Are Your Arguments? Why Should We Care Construct at least 4 different claims (four different "I Says") supporting your working thesis statement, which could in turn be supported by evidence from...

3. Using the table below, which displays information for the same perfectly competitive firm during the shortrun, answer the following questions. Units of Labor, L 234 5 6 7 Total Product (TP) 20 30...

Discussion question it doses not have to be long (minimum 250 words and, at least, one source current) Textbook Fitzsimmons, J., Fitzsimmons, M., & Bordoloi, S. (2014). Service management:...

Explain the main characteristics of an active equity investment strategy based on market timing. [10 marks] II. Consider the following information about the performance of two fund managers during...

Linux disk management includes several important tasks such as adding or removing storage devices, creating and deleting partitions, mounting partitions on appropriate directories and making file...

Highlight the passive phrase in yellow. Underneath the sentence, revise to remove passive voice. If you choose to keep the sentence in passive, explain why. Then upload the Word file to the drop box....

Reread the discussion leading to the result given in (7). Does the matrix sI  A always have an inverse? Discuss.

Combine the statements that you wrote in Exercise 5.5 into a C# app that calculates and displays the sum of the integers from 1 to 10. Use a while statement to loop through the calculation and...

Write statements that perform the following onedimensionalarray operations: a) Set the three elements of integer array counts to 0. b) Add 1 to each of the four elements of integer array bonus. c)...

Determine whether each of the following is true or false. If false, explain why. a) A single array can store values of many different types. b) An array index should normally be of type float. c) An...

Ed owns Oak Knoll Apartments. During the year, Fred, a tenant, moved to another state. Fred paid Ed \($1,000\) to cancel the twoyear lease he had signed. Ed subsequently began renting the unit to...

Sally W. Emanual, a teacher, had the following dividends and interest during 2022: Additional information pertaining to Sally Emanual includes The taxable portion of the pension is \($7,000.\) Sally...

What is the first day that an individual could sell a capital asset purchased on March 31, 2023, and have a holding period of more than one year?
Study smarter with the SolutionInn App