Question regarding Calculating Volume in Java

Randi Poling

Distinguished
Feb 19, 2014
251
27
18,840
THee is a lab I am working on for Java Programming and I am kind of in a pinch. I have got everything else down for this lab except for the following:

Volume of a pentagon prism = 5(𝑝𝑒𝑛𝑡𝑎𝑔𝑜𝑛𝑆𝑖𝑑𝑒2 )/ 4(tan( 𝜋 5 )) x prismHeight
Volume of a regular pentagon pyramid = 1/24 (5 + √5) 𝑝𝑒𝑛𝑡𝑎𝑔𝑜𝑛𝑆𝑖𝑑𝑒 3

Any hints on as to write it to calculate these out? Or any sites that would have some good tutorials on doing so?
 
hint... search for Volume of a pentagon prism java in google

https://www.geeksforgeeks.org/program-to-find-volume-and-surface-area-of-pentagonal-prism/

Code:
// Java program to find 
// surface area and volume of the 
// Pentagonal Prism 
import java.util.*; 

class solution 
{ 

// function for surface area 
static float surfaceArea(float a, float b, float h) 
{ 

    return 5 * a * b + 5 * b * h; 

} 

// function for VOlume 
static float volume(float b, float h) 
{ 

    return (5 * b * h) / 2; 

} 

// Driver function 
public static void main(String arr[]) 
{ 
    float a = 5; 
    float b = 3; 
    float h = 7; 

    System.out.println( "surface area= "+surfaceArea(a, b, h)+", "); 

    System.out.println("volume= "+volume(b, h)); 
} 
} 
[/code[

there it is in several programming languages

perform a similar google search for the other thing you need. use your internet resources.