From 88ad51ea8d457fe38e65751b9021bff3b6cebf7e Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:19:14 +0000 Subject: [PATCH 01/16] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20gitops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gitops/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gitops/.keep diff --git a/gitops/.keep b/gitops/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From 49af4ed102908a05b9503a44047dfe6a5af012e9 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:19:35 +0000 Subject: [PATCH 02/16] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20gitee?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gitops/gitee/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gitops/gitee/.keep diff --git a/gitops/gitee/.keep b/gitops/gitee/.keep new file mode 100644 index 0000000..e69de29 -- Gitee From 08dfddd1efca917373085e597814c720179bb21a Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:24:43 +0000 Subject: [PATCH 03/16] add gitops/gitee/ICalculate.java. --- gitops/gitee/ICalculate.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 gitops/gitee/ICalculate.java diff --git a/gitops/gitee/ICalculate.java b/gitops/gitee/ICalculate.java new file mode 100644 index 0000000..0fe70cf --- /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 -- Gitee From 01acea0150aaa3b3e6b6666fbd7a6516d2d24f4e Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:25:44 +0000 Subject: [PATCH 04/16] add gitops/gitee/Calculate.java. --- gitops/gitee/Calculate.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 gitops/gitee/Calculate.java diff --git a/gitops/gitee/Calculate.java b/gitops/gitee/Calculate.java new file mode 100644 index 0000000..b413c5a --- /dev/null +++ b/gitops/gitee/Calculate.java @@ -0,0 +1,7 @@ +package gitops.gitee; + +class Calculate{ + public void doCalculate(ICalculate cal,double a,double b){ + cal.calculate(a,b); + } +} \ No newline at end of file -- Gitee From 143f3ed7ba68e0703c2fe763e42b7e4baaa7ed58 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:27:18 +0000 Subject: [PATCH 05/16] add gitops/gitee/Add.java. --- gitops/gitee/Add.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gitops/gitee/Add.java diff --git a/gitops/gitee/Add.java b/gitops/gitee/Add.java new file mode 100644 index 0000000..0175a26 --- /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 -- Gitee From e79ccabf358986eb7077650dbc5188ea3a348ca0 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:29:33 +0000 Subject: [PATCH 06/16] add gitops/gitee/Calculator.java. --- gitops/gitee/Calculator.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gitops/gitee/Calculator.java diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java new file mode 100644 index 0000000..837088e --- /dev/null +++ b/gitops/gitee/Calculator.java @@ -0,0 +1,30 @@ +//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!"); + 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(); + cal.doCalculate(new Add(),op1,op2); + cal.doCalculate(new Sub(),op1,op2); + cal.doCalculate(new Mul(),op1,op2); + cal.doCalculate(new Div(),op1,op2); + cal.doCalculate(new Mod(),op1,op2); + cal.doCalculate(new Fac(),op1,op2); + cal.doCalculate(new Pow(),op1,op2); + break; + } + } + } +} \ No newline at end of file -- Gitee From f86a27b057d81dd06459f7e0af6671fed6a13c19 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 20:45:14 +0800 Subject: [PATCH 07/16] Gitee Calculator + add --- gitops/gitee/Calculate.java | 4 ++-- gitops/gitee/Calculator.java | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/gitops/gitee/Calculate.java b/gitops/gitee/Calculate.java index b413c5a..4be8d5c 100644 --- a/gitops/gitee/Calculate.java +++ b/gitops/gitee/Calculate.java @@ -1,7 +1,7 @@ package gitops.gitee; class Calculate{ - public void doCalculate(ICalculate cal,double a,double b){ - cal.calculate(a,b); + 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 index 837088e..455833e 100644 --- a/gitops/gitee/Calculator.java +++ b/gitops/gitee/Calculator.java @@ -10,19 +10,14 @@ public class Calculator { double op1=12; double op2=13; System.out.println("Please Input Two Double Numbers & Non Double to Exit!"); - while(sc.hasNextDouble()){ + 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(); - cal.doCalculate(new Add(),op1,op2); - cal.doCalculate(new Sub(),op1,op2); - cal.doCalculate(new Mul(),op1,op2); - cal.doCalculate(new Div(),op1,op2); - cal.doCalculate(new Mod(),op1,op2); - cal.doCalculate(new Fac(),op1,op2); - cal.doCalculate(new Pow(),op1,op2); + System.out.println(op1+" + "+op2+" = "+ cal.doCalculate(new Add(),op1,op2)); break; } } -- Gitee From ebfaf5842473b77ae309895059020412410181a9 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:49:44 +0000 Subject: [PATCH 08/16] add gitops/gitee/Sub.java. --- gitops/gitee/Sub.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gitops/gitee/Sub.java diff --git a/gitops/gitee/Sub.java b/gitops/gitee/Sub.java new file mode 100644 index 0000000..fb0e7d2 --- /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 -- Gitee From c322dfa8c02ed9cad9e20dbf6e2b57cfa47da177 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:51:14 +0000 Subject: [PATCH 09/16] update gitops/gitee/Calculator.java. --- gitops/gitee/Calculator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java index 455833e..ff9c465 100644 --- a/gitops/gitee/Calculator.java +++ b/gitops/gitee/Calculator.java @@ -18,6 +18,7 @@ public class Calculator { 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)); break; } } -- Gitee From d5f53469690fcd68c128b2ebb57bb42ba7847d4d Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:56:13 +0000 Subject: [PATCH 10/16] add gitops/gitee/Mul.java. --- gitops/gitee/Mul.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 gitops/gitee/Mul.java diff --git a/gitops/gitee/Mul.java b/gitops/gitee/Mul.java new file mode 100644 index 0000000..002b4fa --- /dev/null +++ b/gitops/gitee/Mul.java @@ -0,0 +1,9 @@ +package gitops.gitbash; +class Mul implements ICalculate{ + private double result; + public double calculate(double m,double n){ + result=m*n; + System.out.println(m+"*"+n+"="+result); + return result; + } +} \ No newline at end of file -- Gitee From 82e59b078f253cc174910752f8e4c7e40e81e966 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:57:03 +0000 Subject: [PATCH 11/16] update gitops/gitee/Mul.java. --- gitops/gitee/Mul.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitops/gitee/Mul.java b/gitops/gitee/Mul.java index 002b4fa..7174b18 100644 --- a/gitops/gitee/Mul.java +++ b/gitops/gitee/Mul.java @@ -1,9 +1,11 @@ package gitops.gitbash; + class Mul implements ICalculate{ + private double result; + public double calculate(double m,double n){ result=m*n; - System.out.println(m+"*"+n+"="+result); return result; } } \ No newline at end of file -- Gitee From a401b5dde394fe2d378aa2470ce3b0477cbb67df Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 12:57:51 +0000 Subject: [PATCH 12/16] update gitops/gitee/Calculator.java. --- gitops/gitee/Calculator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java index ff9c465..52f5f77 100644 --- a/gitops/gitee/Calculator.java +++ b/gitops/gitee/Calculator.java @@ -19,6 +19,7 @@ public class Calculator { 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 Sub(),op1,op2)); break; } } -- Gitee From e328f66b8662f893fdb33c7c56d141e8bc2642f7 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 21:03:38 +0800 Subject: [PATCH 13/16] +Mul --- gitops/gitee/Calculator.java | 2 +- gitops/gitee/Mul.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java index 52f5f77..b6e79a4 100644 --- a/gitops/gitee/Calculator.java +++ b/gitops/gitee/Calculator.java @@ -19,7 +19,7 @@ public class Calculator { 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 Sub(),op1,op2)); + System.out.println(op1+" * "+op2+" = "+ cal.doCalculate(new Mul(),op1,op2)); break; } } diff --git a/gitops/gitee/Mul.java b/gitops/gitee/Mul.java index 7174b18..b6629b5 100644 --- a/gitops/gitee/Mul.java +++ b/gitops/gitee/Mul.java @@ -1,4 +1,4 @@ -package gitops.gitbash; +package gitops.gitee; class Mul implements ICalculate{ -- Gitee From bfa96febd00735e4191fa374b5ec3a0e5f361442 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 13:04:06 +0000 Subject: [PATCH 14/16] add gitops/gitee/Div.java. --- gitops/gitee/Div.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 gitops/gitee/Div.java diff --git a/gitops/gitee/Div.java b/gitops/gitee/Div.java new file mode 100644 index 0000000..f2b48a1 --- /dev/null +++ b/gitops/gitee/Div.java @@ -0,0 +1,13 @@ +package gitops.gitbash; +class Div implements ICalculate{ + private double result; + public double calculate(double m,double n){ + if(0==n){ + System.out.println("ERROR: / by zero!"); + return 0.0; + } + result=m/n; + System.out.println(m+"/"+n+"="+result); + return result; + } +} \ No newline at end of file -- Gitee From f609150cf54a73fb590c6fb54b2f4fe364a0ea2a Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 13:05:46 +0000 Subject: [PATCH 15/16] +Div --- gitops/gitee/Div.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gitops/gitee/Div.java b/gitops/gitee/Div.java index f2b48a1..7fdf151 100644 --- a/gitops/gitee/Div.java +++ b/gitops/gitee/Div.java @@ -1,13 +1,11 @@ -package gitops.gitbash; +package gitops.gitee; + class Div implements ICalculate{ + private double result; + public double calculate(double m,double n){ - if(0==n){ - System.out.println("ERROR: / by zero!"); - return 0.0; - } result=m/n; - System.out.println(m+"/"+n+"="+result); return result; } } \ No newline at end of file -- Gitee From a72863e8c28173c1e37d1472715e8ac6a1103091 Mon Sep 17 00:00:00 2001 From: czldl Date: Fri, 24 Sep 2021 13:08:28 +0000 Subject: [PATCH 16/16] +Div --- gitops/gitee/Calculator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitops/gitee/Calculator.java b/gitops/gitee/Calculator.java index 52f5f77..0b4ab29 100644 --- a/gitops/gitee/Calculator.java +++ b/gitops/gitee/Calculator.java @@ -19,7 +19,8 @@ public class Calculator { 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 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; } } -- Gitee