diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..6f29fee 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Java-Assignment-004.iml b/Java-Assignment-004.iml index b46c0dd..e1006ff 100644 --- a/Java-Assignment-004.iml +++ b/Java-Assignment-004.iml @@ -5,6 +5,7 @@ + \ No newline at end of file diff --git a/README.md b/README.md index 46e3536..f1146c1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Java Assignment 004 +## Help with Assignment!! +this one was a challenge. I had to resort to Chatgpt to help with the syntax. I was able to map it(?) correctly. +But I couldn't implement the String provided for the methods. + **Instructions:** 1. Fork this repository to your GitHub account. 2. Clone the forked repository locally to your machine. diff --git a/src/Multadd.java b/src/Multadd.java new file mode 100644 index 0000000..65501de --- /dev/null +++ b/src/Multadd.java @@ -0,0 +1,52 @@ +public class Multadd { + + public static double multAdd(double a, double b, double c) { + + return a * b + c; + } + + public static double expSum(double x) { + double exp1 = Math.exp(x); + double exp2 = Math.exp(x); + + return multadd2(1.0, exp1, exp2); + } + + private static double multadd2(double v, double exp1, double exp2) { + return v; + } + + public static void main(String[] args) { + System.out.println(multAdd(1.0, 2.0, 3.0)); + double v = computeExpression1(); + System.out.println(v); + double w = computeExpression2(); + System.out.println(w); + double x = expSum(5); + System.out.println(x); + + } + + //Had trouble implementing: $$\sin\left(\frac{\pi}{4}\right) + \frac{\cos\left(\frac{\pi}{4}\right)}{2}$$ + public static double computeExpression1() { + double pi = Math.PI; + double angle = pi / 4; + + double sinValue = Math.sin(angle); + double cosValue = Math.cos(angle); + + double expressionValue = sinValue + (cosValue / 2); + + return expressionValue; + } + + public static double computeExpression2() { + double log10_10 = Math.log10(10); + double log10_20 = Math.log10(20); + + double expressionValue = log10_10 + log10_20; + + return expressionValue; + } + +}