Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *##..'^---^'..##*
- */
- import java.io.*;
- import java.io.IOException;
- public class Main {
- static BufferedReader waa = new BufferedReader(new InputStreamReader(System.in));
- static double input1, input2;
- static int z;
- static double output;
- public static void choices() throws IOException {
- System.out.println("Enter A Value 1-4\n1 - Addition\n2 - Subtraction\n3 - Multiplication\n4 - Division\nInput it Here: ");
- String Valz = waa.readLine();
- z = Integer.parseInt(Valz);
- }
- public static void Operation() throws IOException {
- System.out.print("Input 1st Number: ");
- String val1 = waa.readLine();
- input1 = Integer.parseInt(val1);
- }
- public static void Operation2() throws IOException {
- System.out.print("Input 2nd Number: ");
- String val2 = waa.readLine();
- input2 = Integer.parseInt(val2);
- }
- public static vod Ope1Ope2() throws IOException {
- Operation();
- Operation2();
- }
- public static void OperationOfNumbers() throws IOException {
- switch(z) {
- case 1:
- Ope1Ope2();
- output = input1 + input2;
- display();
- break;
- case 2:
- Ope1Ope2();
- output = input1 - input2;
- display();
- break;
- case 3:
- Ope1Ope2();
- output = input1 * input2;
- display();
- break;
- case 4:
- Ope1Ope2();
- output = input1 / input2;
- display();
- break;
- default:
- System.out.println("Error: Please Try it Again");
- do {
- choices();
- OperationOfNumbers();
- }while(z != );
- break;
- }
- }
- public static void display() throws IOException {
- System.out.println("The Total Value: " + output);
- }
- public static void main(String args[]) throws IOException {
- choices();
- OperationOfNumbers();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement