Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BeerKegs {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numberKegs = Integer.parseInt(scanner.nextLine());
- String biggestKeg = "";
- double highestVolume = Double.MIN_VALUE;
- for (int i = 1; i <=numberKegs ; i++) {
- String model = scanner.nextLine();
- double radius = Double.parseDouble(scanner.nextLine());
- int height = Integer.parseInt(scanner.nextLine());
- double volume = Math.PI*Math.pow(radius, 2)*height;
- if (volume>highestVolume){
- highestVolume=volume;
- biggestKeg=model;
- }
- }
- System.out.println(biggestKeg);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement