Advertisement
Guest User

Untitled

a guest
May 26th, 2019
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. package Exercise1002;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Exercise1002 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.  
  10.         int counter = Integer.parseInt(scanner.nextLine());
  11.  
  12.  
  13.         double maxVolume=0;
  14.         String biggestKeg= "";
  15.         while (counter-- > 0);{
  16.             String model = scanner.nextLine();
  17.             double radius = Double.parseDouble(scanner.nextLine());
  18.             int height =Integer.parseInt(scanner.nextLine());
  19.  
  20.             double volume = Math.PI * radius * radius * height;
  21.  
  22.             if (volume > maxVolume){
  23.                 maxVolume = volume;
  24.                 biggestKeg = model;
  25.             }
  26.  
  27.         }
  28.         System.out.println(biggestKeg);
  29.  
  30.  
  31.  
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement