-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF8BeerKegs.java
More file actions
27 lines (21 loc) · 794 Bytes
/
Copy pathF8BeerKegs.java
File metadata and controls
27 lines (21 loc) · 794 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
package DataTypesandVariables;
import java.util.Scanner;
public class F8BeerKegs {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int countKegs = Integer.parseInt(scanner.nextLine());
double maxVolume = Double.MIN_VALUE; //or 0
String maxModel = "";
for (int i = 0; i < countKegs; i++) {
String model = scanner.nextLine();
double radius = Double.parseDouble(scanner.nextLine());
int height = Integer.parseInt(scanner.nextLine());
double volume = Math.PI * height * (radius * radius);
if (volume > maxVolume) {
maxVolume = volume;
maxModel = model;
}
}
System.out.println(maxModel);
}
}