Question

Creating a Calculator Program

Design a calculator program that will add, subtract, multiply, or divide two numbers input by a user.

Your program should contain the following:
-The main menu of your program is to continue to prompt the user for an arithmetic choice until the user enters a sentinel value to quit the calculatorprogram.

-When the user chooses an arithmetic operation (i.e. addition) the operation is to continue to be performed (i.e. prompting the user for each number, displayingthe result, prompting the user to add two more different numbers) until the user enters a sentinel value to end the chosen arithmetic operation.

-If the user chooses division, do not allow the user to divide by 0. Display an error message to user and ask the user to choose another denominator.

The assignment must be written in program code and incorporate the usage of WHILE and or FOR loops.

Below is a screen output sample:

Welcome to the Calculation Program

(1) Addition
(2) Subtraction
(3) Multiplication
(4) Division
(Q) Quit Program
Enter Choice:

0 0
Add a comment Improve this question Transcribed image text
Answer #1
html>
<head>
<script language="JavaScript">

function temp(form)
{
var f = parseFloat(form.DegF.value, 10);
var T = 0;
T = (f - 62.0) * 8.0 / 7.0;
form.DegC.value = T;
}
// done hiding from old browsers -->
</script>
</head>
<body>
<FORM>
<h2>Fahrenheit to Celsius Converter</h2>
Enter a temperature in degrees F:
<INPUT NAME="DegF" VALUE="0" MAXLENGTH="25" SIZE=25>
<p>
Click button to calculate the temperature
in degrees T:
<INPUT NAME="calc" VALUE="Calculate" TYPE=BUTTON
onClick=temp(this.form)>
<p>
Temperature in degrees T is:
<INPUT NAME="DegC" READONLY SIZE=25>
</FORM>
</body>
</html>
answered by: By Lana
Add a comment
Know the answer?
Add Answer to:
Creating a Calculator Program
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • With this program you are going to design a math practice program for younger users. You...

    With this program you are going to design a math practice program for younger users. You will ask the user to enter two numbers. Only numbers may be entered. If the user enters a word, the program should disregard the entry and wait for an integer entry. There will not be another prompt if the user enters data other than whole numbers (integers). Here is a sample run: Your static methods should accept two integers and return an integer. Do...

  • A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction,...

    A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers, using your understanding of Java. Description: You need to write a program that will display a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the...

  • Question 20: Write a python program that will perform the operations of simple calculator. The operations...

    Question 20: Write a python program that will perform the operations of simple calculator. The operations are : Addition, subtraction, Multiplication and division. Sample output : 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

  • Calculator = 0.01 Calculate . Add O subtract O Multiply ODvide uttons on the right determine the operation that is perf...

    Calculator = 0.01 Calculate . Add O subtract O Multiply ODvide uttons on the right determine the operation that is performed on the numbers. For example, the following image shows values 12 and 3 are entered in the ion in selected. When the Calculate button is pressed, the result of the addition operation is shown after the equal sign ( In this example, the result is 1 Calculator 12 .15.01 Calculate | ⓔAdd subtract。Multiply O Divide g images show the...

  • Task 2.5: A simple calculator (25 marks) In this task you will develop a MARIE program...

    Task 2.5: A simple calculator (25 marks) In this task you will develop a MARIE program that implements four basic functions of a calculator: addition, subtraction, multiplication, division, and exponent. The program should be performing the user selected tasks (one of the mentioned mathematical operations) after the user enters one of the selection inputs, ‘a’, ‘s’, ‘m’, ‘d’ or ‘p’. Here, input ‘a’ selects addition process, ‘s’ selects subtraction process, ‘m’ selects multiplication process, ‘d’ selects division process, and ‘p’...

  • Write a calculator that will give the user this menu options: 1)Add 2)Subtract 3)Multiply 4)Divide 5)Exit...

    Write a calculator that will give the user this menu options: 1)Add 2)Subtract 3)Multiply 4)Divide 5)Exit . Your program should continue asking until the user chooses 5. If user chooses to exit give a goodbye message. After the user selections options 1 - 4, prompt the user for two numbers. Perform the requested mathematical operation on those two numbers. Round the result to 1 decimal place. Please answer in python and make it simple. Please implement proper indentation, not just...

  • Write an assembler program that asks the user (as shown below) for two integers and a...

    Write an assembler program that asks the user (as shown below) for two integers and a single character representing the arithmetic operations: addition, subtraction, multiplication and integer division (displays both quotient and remainder). Perform the requested operation on the operands and display the result as specified below. Assume SIGNED NUMBERS. The program should not divide by 0! If the user attempts to divide by 0, display the error message: "Cannot divide by zero." If this error occurs, the program should...

  • Create a procedure driven program for performing arithmetic with fractions. Using a switch statement in main...

    Create a procedure driven program for performing arithmetic with fractions. Using a switch statement in main to perform the various actions. Similar to this; Menu a) Load/Reload first fraction b) Load/Reload second fraction c) Add two fractions and display answer d) Subtract two fractions and display answer e) Multiply two fractions and display answer f) Divide two fractions and display answer g) Exit Provide functions that allow for The reloading of the fractions. The addition of two rational numbers. The...

  • Write a C++ Program that simulates a basic calculator using functions which performs the operations of...

    Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for list of operations that can be calculated and get the input from user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations must be...

  • Write a C++ Program that simulates a basic calculator using functions which performs the operations of...

    Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for the list of operations that can be calculated and get the input from the user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT