Question: Using Bluefish, create a Java file named Calc.java in your Working Directory. Create a public class named Calc. Request a double precision number from the

Using Bluefish, create a Java file named Calc.java in your "Working Directory".

Create a public class named Calc.

Request a double precision number from the user.

Request a second double precision number from the user.

Request an operation from the user. Valid inputs will be {+ - * /} - the program should display an error if an invalid operator is provided by the user.

Perform the requested calculation on the two numbers, and display the double precision answer on the screen.

Compile your program, and make sure that it works as expected.

Hint 1: Use a switch statement to select the operation to perform.

This is what I have so far....

import java.util.Scanner;

class calc{ public static void main(String args []){ Scanner calculation = new Scanner(System.in); double num1,num2,answer; System.out.println ("Enter your first number:"); num1 = calculation.nextDouble(); System.out.println("Enter your second number:"); num2 = calculation.nextDouble(); answer = ; System.out.println(answer); }

}

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!