From 8f9aa9c3ae002a358888ba9b230fc6f36e5d2c7d Mon Sep 17 00:00:00 2001 From: prodriguez988 Date: Sun, 11 Feb 2024 23:55:19 -0800 Subject: [PATCH] Complete Assignment 004 --- .idea/misc.xml | 2 +- .idea/vcs.xml | 6 ++++++ Java-Assignment-004.iml | 1 + src/Multadd.java | 22 ++++++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .idea/vcs.xml create mode 100644 src/Multadd.java diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..47478b9 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..5d8b2d1 --- /dev/null +++ b/src/Multadd.java @@ -0,0 +1,22 @@ +public class Multadd { + public static void multadd(double a, double b, double c){ + double trig, logarithm,answer; + answer=(a*b+c); + System.out.println("The result of a*b+c is: "+ answer); //Computes the value of multadd + trig=(Math.sin(Math.PI/4.0)+ (Math.cos(Math.PI/4.0))/2); //computed the value of the trigonometric equation + logarithm=Math.log10(10.0)+Math.log10(20.0); //Computes the value of the logarithmic equation + System.out.println("The result of the trigonometric equation sin(pi/4) + (cos(pi/4))/2 is: " + trig); + System.out.println("The result of the logarithmic equation log(10)+log(20) is: "+logarithm); + + } + public static void expSum(double x){ + double result; + result=x*Math.exp(-x)+Math.sqrt(1-Math.exp(-x)); + System.out.println("The result of the exponential equation is: " +result); //computes the value of the exponential equation called from main + } + public static void main(String[] args) { + multadd(1.0,2.0,3.0); + expSum(1.0); + + } +}