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 15-14=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 15-14=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 15-14=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 15-14=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
-
Rodriguez Corporation issues 14,000 shares of its common stock for $237,300 cash on February 20. Prepare journal entries to record this event under each of the following separate situations. 1. The...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. 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?
-
Refer to the previous exercise. a. Explain how the result of the 95% confidence interval shown in the table agrees with the test decision using the 0.05 significance level. b. Suppose you instead...
-
Scenario: TheDirectorofExhibitsattheCanadianMuseumofNature,locateddowntownOttawahashiredyouas aprojectmanager.YouwillstartworkingonMonday,May3rd,2021....
-
Bartlett Company, headquartered in Cincinnati, Ohio, has occasional transactions with companies in a foreign country whose currency is the lira. Prepare journal entries for the following transactions...
-
Midland Oil has $1,000 par value bonds outstanding at 8 percent interest. The bonds will mature in 25 years. Compute the current price of the bonds if the present yield to maturity is: a. 7% b. 10%...
-
The following is the partial bond discount amortization schedule for Novak Corp. Novak uses the effective-interest method of amortization. Interest Periods Interest to Be Paid Interest Expense to Be...
-
During the courtship and negotiation stages, managers often emphasize "equal partnerships" and do not reveal (or even try to hide) their true intentions. What are the ethical dilemmas here?
-
Determine the operating income for Company T using the following data: Sales Revenue: $1,000,000 Cost of Goods Sold: $400,000 Operating Expenses: $200,000 Calculate the operating income for Company T.
-
The English statistician Karl Pearson (1857-1936) introduced a formula for the skewness of a distribution. P = 3 ( x median ) s Pearson's index of skewness Most distributions have an index of...
-
You are to specify an orifice meter for measuring the flow rate of a $35^{\circ} \mathrm{API}$ distillate $(\mathrm{SG}=0.85$ ) flowing in a $2 \mathrm{in}$. sch 160 pipe at $70^{\circ} \mathrm{F}$....
-
Let $\theta$ and $\phi$ be the polar coordinates. Introduce the complex numbers $z$ and $\bar{z}$, where $$\begin{equation*} z=e^{i \phi} \tan (\theta / 2) \equiv \xi+i \eta \tag{5.393}...
-
Suppose the profit \(P\) (in dollars) of a certain item is given by \(P=1.25 x-850\), where \(x\) is the number of items sold. a. Graph this profit relationship. b. Interpret the value of \(P\) when...
-
(a) Draw a simplified ray diagram showing the three principal rays for an object located outside the focal length of a diverging lens. (b) Is the image real or virtual? (c) Is it upright or inverted?...
-
Question 2 10 Consider a capital expenditure project to purchase and a new equipment with an inal cash out of 2.000. The project is expected to generate retter to cash ach year for betermine whether...
-
Rewrite the code of Figure 7.3 in Ada, Java, or C#. Figure 7.3: template class queue { item items [max_items]; int next_free, next_full, num_items; public: queue () : next_free (0), next_full(0),...
-
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 one-dimensional-array 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...
-
The International Licensing Industry Merchandisers Association (LIMA; www.licensing.org) is an organization with offices worldwide. It supports merchandise licensing through education, networking,...
-
Suppose you are an international entrepreneur and want to open your own franchise somewhere in Europe. You decide to conduct research to identify the most promising franchise and learn how to become...
-
What are the advantages and disadvantages of licensing? LO.1
![Mobile App Logo](https://dsd5zvtm8ll6.cloudfront.net/includes/images/mobile/finalLogo.png)
Study smarter with the SolutionInn App