Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Type your name here
- package YOURPROJECTNAME;
- import java.util.Scanner;
- public class YOURPROJECTNAME {
- public static void main(String[] args) {
- double number1, number2;
- int choice;
- Scanner input = new Scanner(System.in);
- System.out.print("Enter the first number: ");
- number1 = input.nextDouble();
- System.out.print("Enter the second number: ");
- number2 = input.nextDouble();
- //Insert code here
- if(choice == 1)
- System.out.println(number1+number2);
- else if(choice == 2)
- System.out.println(number1-number2);
- //continue this code for multiplication and division
- }
- }
- /* Sample output
- Enter the first number: 35.5
- Enter the second number: 12.6
- What would you like to do?
- 1. Addition
- 2. Subtraction
- 3. Multiplication
- 4. Division
- Choice: 4
- 48.1
- */
Add Comment
Please, Sign In to add comment