diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..172df7b 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/src/Multadd.java b/src/Multadd.java new file mode 100644 index 0000000..a9329d3 --- /dev/null +++ b/src/Multadd.java @@ -0,0 +1,32 @@ +public class Multadd { + public static void main(String[] args) { + double a = 1.0; + double b =2.0; + double c = 3.0; + double Mresult = multadd(a, b, c); + System.out.println("1.Value=" + Mresult); + double sin = Math.sin(Math.PI / 4); + double placeHolder = 1.0; + //used to keep take place/nullify of b in order to just add a and c + double cos = Math.cos(Math.PI / 4) / 2.0; + double value1 = multadd(sin, placeHolder, cos); + System.out.println("2.Value=" + value1); +double logTerm1 = Math.log10(10); + double logTerm2 = Math.log10(20); + double value2 = multadd(logTerm1, placeHolder, logTerm2); + System.out.println("3.Value=" + value2); + double x = 6.0; + //assigned number to x can be changed in order to calculate a different value + double value3 = expSum(x); + System.out.println("4.Value=" + value3); + } + public static double multadd(double a, double b, double c) { + return a * b + c; + // initial format + } + public static double expSum(double x) { +double two = Math.exp(-x); +double three = Math.sqrt(1 - Math.exp(-x)); +return multadd(x, two, three); + } +}