diff --git a/pom.xml b/pom.xml index 238ad6a..60d3c63 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,34 @@ 4.12 test + + commons-math + commons-math + 1.2 + + + org.mortbay.jetty + jetty-util + 6.1.25 + + + in.yajnesh.util + java-util + 1.0.0 + + + user.java.lang + user.java.lang + 2020.164.33984 + + + + clojars + Clojars + https://repo.clojars.org/ + + diff --git a/src/main/java/.idea/.gitignore b/src/main/java/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/main/java/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/main/java/.idea/misc.xml b/src/main/java/.idea/misc.xml new file mode 100644 index 0000000..e0844bc --- /dev/null +++ b/src/main/java/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/.idea/modules.xml b/src/main/java/.idea/modules.xml new file mode 100644 index 0000000..122a905 --- /dev/null +++ b/src/main/java/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/.idea/vcs.xml b/src/main/java/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/main/java/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/com/zipcodewilmington/scientificcalculator/Console.java b/src/main/java/com/zipcodewilmington/scientificcalculator/Console.java index 83f0e97..5e59ade 100644 --- a/src/main/java/com/zipcodewilmington/scientificcalculator/Console.java +++ b/src/main/java/com/zipcodewilmington/scientificcalculator/Console.java @@ -29,4 +29,4 @@ public static Integer getIntegerInput(String prompt) { public static Double getDoubleInput(String prompt) { return null; } -} +} \ No newline at end of file diff --git a/src/main/java/com/zipcodewilmington/scientificcalculator/MainApplication.java b/src/main/java/com/zipcodewilmington/scientificcalculator/MainApplication.java index 5f42132..947af62 100644 --- a/src/main/java/com/zipcodewilmington/scientificcalculator/MainApplication.java +++ b/src/main/java/com/zipcodewilmington/scientificcalculator/MainApplication.java @@ -1,17 +1,107 @@ package com.zipcodewilmington.scientificcalculator; +import java.util.Scanner; + /** * Created by leon on 2/9/18. */ public class MainApplication { public static void main(String[] args) { - Console.println("Welcome to my calculator!"); + Scanner scan = new Scanner(System.in); + System.out.println("Please Enter the first number: "); + int z = scan.nextInt(); + + String op = Console.getStringInput("Enter an operator"); + + if (op.equals("sqr")) { + MainApplication.Square(z); + } + else if(op.equals("sqrt")){ + MainApplication.SquareRoot(z); + } + + else { + + System.out.println("Please Enter the second number: "); + int y = scan.nextInt(); + + if (op.equals("-")) { + MainApplication.Subtraction(z, y); + } + + if (op.equals("+")) { + MainApplication.Addition(z, y); + } + + if (op.equals("/")){ + MainApplication.Division(z, y); + } + } + + + + + /* Console.println("Welcome to my calculator!"); String s = Console.getStringInput("Enter a string"); Integer i = Console.getIntegerInput("Enter an integer"); Double d = Console.getDoubleInput("Enter a double."); Console.println("The user input %s as a string", s); Console.println("The user input %s as a integer", i); - Console.println("The user input %s as a d", d); + Console.println("The user input %s as a d", d); */ + + } + /*static void Addition(){ + Scanner scan = new Scanner(System.in); + System.out.println("Please Enter Numbers: "); + int z = scan.nextInt(); + System.out.println("and :"); + int y = scan.nextInt(); + int x = z+y; + System.out.println("Addition: "+x); + + } + + /* static void Subtraction(){ + Scanner scan = new Scanner(System.in); + System.out.println("Please Enter Numbers: "); + int z = scan.nextInt(); + System.out.println("and :"); + int y = scan.nextInt(); + int x = z-y; + System.out.println("Addition: "+x); + } */ + + static void Addition(int z, int y) { + int x = z + y; + System.out.println("The answer is " + x); + } + + + static void Subtraction(int z, int y){ + int x = z - y; + System.out.println("The answer is " + x); + } + + static void Square(int z) { + int x = z * z; + System.out.println("The answer is " + x); + } + + static void SquareRoot(int z) { + double x = Math.sqrt(z); + int y = (int)x; + System.out.println("The answer is " + y); + } + + + + static void Division(float z,float y){ + float x = z / y; + System.out.println("The answer is " + x); + } + } + +//adding comment to push it \ No newline at end of file diff --git a/src/main/java/out/production/main/.idea/.gitignore b/src/main/java/out/production/main/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/src/main/java/out/production/main/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/src/main/java/out/production/main/.idea/misc.xml b/src/main/java/out/production/main/.idea/misc.xml new file mode 100644 index 0000000..e0844bc --- /dev/null +++ b/src/main/java/out/production/main/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/main/java/out/production/main/.idea/modules.xml b/src/main/java/out/production/main/.idea/modules.xml new file mode 100644 index 0000000..122a905 --- /dev/null +++ b/src/main/java/out/production/main/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/java/out/production/main/.idea/vcs.xml b/src/main/java/out/production/main/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/src/main/java/out/production/main/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file