diff --git a/gitops/.keep b/gitops/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/gitops/gitee/.keep b/gitops/gitee/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/gitops/gitee/Add.java b/gitops/gitee/Add.java new file mode 100644 index 0000000000000000000000000000000000000000..0175a26ed5be8cf26da0af641240aa4b9b33911e --- /dev/null +++ b/gitops/gitee/Add.java @@ -0,0 +1,10 @@ +package gitops.gitee; + +class Add implements ICalculate{ + + private double result; + public double calculate(double m,double n){ + result=m+n; + return result; + } +} \ No newline at end of file diff --git a/gitops/gitee/Calculate.java b/gitops/gitee/Calculate.java new file mode 100644 index 0000000000000000000000000000000000000000..4be8d5c9d420953e450d2d61013ce2bb0cd32390 --- /dev/null +++ b/gitops/gitee/Calculate.java @@ -0,0 +1,7 @@ +package gitops.gitee; + +class Calculate{ + public double doCalculate(ICalculate cal,double a,double b){ + return cal.calculate(a,b); + } +} \ No newline at end of file diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java new file mode 100644 index 0000000000000000000000000000000000000000..0b4ab296a636cc77242588936c23dbb844df65a8 --- /dev/null +++ b/gitops/gitee/Calculator.java @@ -0,0 +1,28 @@ +//Calculator.java +package gitops.gitee; + +import java.util.Scanner; + +public class Calculator { + + public static void main(String[] stra0) { + + double op1=12; + double op2=13; + System.out.println("Please Input Two Double Numbers & Non Double to Exit!"); + Scanner sc = new Scanner(System.in); + while(sc.hasNextDouble()){ + op1=sc.nextDouble(); + while(sc.hasNextDouble()){ + op2=sc.nextDouble(); + System.out.print("Add Sub Mul Div Mod Fac Pow Resultes:\n"); + Calculate cal=new Calculate(); + System.out.println(op1+" + "+op2+" = "+ cal.doCalculate(new Add(),op1,op2)); + System.out.println(op1+" - "+op2+" = "+ cal.doCalculate(new Sub(),op1,op2)); + System.out.println(op1+" * "+op2+" = "+ cal.doCalculate(new Mul(),op1,op2)); + System.out.println(op1+" / "+op2+" = "+ cal.doCalculate(new Div(),op1,op2)); + break; + } + } + } +} \ No newline at end of file diff --git a/gitops/gitee/Div.java b/gitops/gitee/Div.java new file mode 100644 index 0000000000000000000000000000000000000000..7fdf15105eecf29ffb53de74ffc57ada8c3d3cea --- /dev/null +++ b/gitops/gitee/Div.java @@ -0,0 +1,11 @@ +package gitops.gitee; + +class Div implements ICalculate{ + + private double result; + + public double calculate(double m,double n){ + result=m/n; + return result; + } +} \ No newline at end of file diff --git a/gitops/gitee/ICalculate.java b/gitops/gitee/ICalculate.java new file mode 100644 index 0000000000000000000000000000000000000000..0fe70cf4d96c9962ddb16de779daa80677c7e020 --- /dev/null +++ b/gitops/gitee/ICalculate.java @@ -0,0 +1,5 @@ +package gitops.gitee; + +interface ICalculate{ + double calculate(double m, double n); +} \ No newline at end of file diff --git a/gitops/gitee/Mul.java b/gitops/gitee/Mul.java new file mode 100644 index 0000000000000000000000000000000000000000..b6629b5e7cbb70178e1864e8380fdaa628425654 --- /dev/null +++ b/gitops/gitee/Mul.java @@ -0,0 +1,11 @@ +package gitops.gitee; + +class Mul implements ICalculate{ + + private double result; + + public double calculate(double m,double n){ + result=m*n; + return result; + } +} \ No newline at end of file diff --git a/gitops/gitee/Sub.java b/gitops/gitee/Sub.java new file mode 100644 index 0000000000000000000000000000000000000000..fb0e7d2e848b778e8ab0d8bf98433d30c26cbde8 --- /dev/null +++ b/gitops/gitee/Sub.java @@ -0,0 +1,11 @@ +package gitops.gitee; + +class Sub implements ICalculate{ + + private double result; + + public double calculate(double m,double n){ + result=m-n; + return result; + } +} \ No newline at end of file