forked from Denisolt/CSCI-160
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple.java
More file actions
27 lines (26 loc) · 790 Bytes
/
simple.java
File metadata and controls
27 lines (26 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
/**
*
* @author Arshit
*/
public class simple {
public static void main(String [] args)
{
System.out.print("Enter volume of the cylinder:");
Scanner keyboard = new Scanner(System.in);
int volume = keyboard.nextInt();
System.out.print("Enter radius of the cylinder:");
Scanner input = new Scanner(System.in);
int radius = input.nextInt();
double height;
double cost;
while (volume >= 1 && radius >= 1)
{
height = volume/(Math.PI*(radius*radius));
cost = 2 * Math.PI * radius * (radius + height);
System.out.printf("height is: %.2f\n",height);
System.out.printf("cost is: %.2f\n",cost);
break;
}
}
}