Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Java-Assignment-004.iml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
52 changes: 52 additions & 0 deletions src/Multadd.java
Original file line number Diff line number Diff line change
@@ -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;
}

}