Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

a neglect of quality in relationship to international competitors;

Answered: 1 week ago