diff options
Diffstat (limited to 'Master/Software Architektur/SWA_Prakt1/src/net/sven_eisenhauer/swa_prakt1/ArithmeticRunner.java')
| -rw-r--r-- | Master/Software Architektur/SWA_Prakt1/src/net/sven_eisenhauer/swa_prakt1/ArithmeticRunner.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Master/Software Architektur/SWA_Prakt1/src/net/sven_eisenhauer/swa_prakt1/ArithmeticRunner.java b/Master/Software Architektur/SWA_Prakt1/src/net/sven_eisenhauer/swa_prakt1/ArithmeticRunner.java new file mode 100644 index 0000000..b3372f4 --- /dev/null +++ b/Master/Software Architektur/SWA_Prakt1/src/net/sven_eisenhauer/swa_prakt1/ArithmeticRunner.java @@ -0,0 +1,32 @@ +package net.sven_eisenhauer.swa_prakt1;
+
+public class ArithmeticRunner {
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ ArithmeticVariable a = new ArithmeticVariable("a", 2L);
+ ArithmeticVariable b = new ArithmeticVariable("b", 77);
+ ArithmeticVariable c = new ArithmeticVariable("c", 0.1f);
+ ArithmeticVariable d = new ArithmeticVariable("d", 0.00003d);
+
+ ArithmeticExpression aAddb = new ArithmeticAddition(a,b);
+ ArithmeticExpression aSubc = new ArithmeticSubstraction(a,c);
+ ArithmeticExpression bMuld = new ArithmeticMultiplication(b, d);
+
+ ArithmeticExpression ae1 = new ArithmeticMultiplication(aAddb, aSubc);
+ ArithmeticExpression ae2 = new ArithmeticSubstraction(bMuld, a);
+
+ ArithmeticExpression ae3 = new ArithmeticDivision(new ArithmeticAddition(ae1, ae2),new ArithmeticVariable("e", 100000));
+
+ try {
+ ae3.print();
+ System.out.println("\nResult: "+ae3.evaluate());
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ }
+
+}
|
