Question: 3. 3 Write a function clunkyCalculator that, when called, will perform the basic tasks of a calculator (addition, subtraction, multiplication, and division) for two numbers.

 3. 3 Write a function clunkyCalculator that, when called, will perform

3. 3 Write a function clunkyCalculator that, when called, will perform the basic tasks of a calculator (addition, subtraction, multiplication, and division) for two numbers. The user should be asked to enter the first number, then the operator to use, and then the second number, and the program should output the correct result. Note that the numbers might not be integers. This function should loop, asking the user if they want to perform another calculation, and if so, repeating the process above. If the user does not want to continue, the program should output "Bye!" and then exit the loop. The casing of the user's response to this question should be ignored. To help with this, write a function calculate that takes 3 inputs (the first number, the operator as a String, c.g. "+", and the sccond number) and returns the correct answer. For example, calculate(2,"*",3.2) would calculate 2 * 3.2 and return the number 6.4. Up to 5 marks will be awarded for flair, i.e., useful functionality that is in addition to that requested in this question. Include comments in your code to explain what is happening. The example below shows how your function should behave: (50 marks] clunkyCalculator(); // put this in setup() // in Serial Monitor Please enter your calculation First number: 12.00 Operator: + Second number: 7.10 - 19.10 Do you want to perform another calculation? Yes Please enter your calculation First number: 11.50 Operator: / Second number: 7.00 1.64 Do you want to perform another calculation? no Bye

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!