-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAreaAndVolume.java
More file actions
28 lines (26 loc) · 1.04 KB
/
AreaAndVolume.java
File metadata and controls
28 lines (26 loc) · 1.04 KB
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
28
/*
* @class: AreaAndVolume
* @author: Hugo Padilla
* @course: ITEC 2140 - 05, Spring 2023
* @version: 1.0
* @date: February 5th, 2023
* @description: This program will calculate the area and volume of a cylinder, with
* user inputs of radius.
*/
package TextbookHomework2;
import java.util.Scanner;
public class AreaAndVolume {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the radius: ");
int radius = input.nextInt();
System.out.print("Enter the length: ");
int length = input.nextInt();
System.out.println("You inputted radius " + radius + "."); // Verifies the amounts given,
System.out.println("You inputted length " + length + ".");
double area = radius * radius * 3.1416; // Provides calculation of area and volume.
double volume = area * length;
System.out.println("This results in an area of " + area + ", with a volume of " + volume + ".");
input.close();
}
}