Question: Write code (HTML) that performs the four basic arithmetic operations (+, -, *, /). The code uses a single prompt box to ask the user

Write code (HTML) that performs the four basic arithmetic operations (+, -, *, /). The code uses a single prompt box to ask the user to enter the first number, the operator, and the second number in this order. The code then displays the result in an alert message box. Use a switch statement. Each operator is a character and is a case in the switch block.

Assume the numbers and the operator are separated by single spaces. There is no space at the beginning nor at the end. It is also assumed that the user always enters the expression correctly.

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!