37.4k views
0 votes
Java Eclipse homework. I need help coding this

Project6A - Compute this

package: proj6A
class: ComputeThis

Create a new package in your Lesson 06 folder called project6a.
Next create a class named ComputeThis.
The main method of should calculate the value of the following formulas and present the answers as shown.

d1 = 3πsin(187°) + |cos(122°)| …Remember that the arguments of sin and cos must be in radians.
d2 = (14.72)3.801 + ln 72 …ln means log base e
The output of your code should appear as follows:
d1 = -0.618672237585067
d2 = 27496.988867001543
---------------------------------------------
Extend: Now write a program to calculate the surface area and volume of a cylinder with a radius of 2 feet and a height of 5 feet.

User Mcfedr
by
6.3k points

1 Answer

7 votes

public class ComputeThis {

public static void main(String[] args) {

double d1 = 3*Math.PI*Math.sin(3.26377)+ Math.abs(Math.cos(2.1293));

double d2 = ((14.72)*3.801)+(Math.log(72));

double surfaceArea = (2*Math.PI*2*5) + (2*Math.PI * (2*2));

double volume = Math.PI * (2 * 2) * 5;

System.out.println(d1);

System.out.println(d2);

System.out.println("\\The volume and surface area of a cylinder with radius of 2 feet and height of 5 feet.");

System.out.println(volume);

System.out.println(surfaceArea);

}

}

I hope this helps!

User Pushpendra Kumar
by
6.2k points