Advertisement
deyanmalinov

08. Beer Kegs

Feb 13th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. package DPM;
  2. import java.util.*;
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int beerNum = Integer.parseInt(scan.nextLine());
  7.         String beerName, bearNameBig="";
  8.         double rad, volume, bigVolume=0;
  9.         int hig;
  10.         while (beerNum>0){
  11.             beerName = scan.nextLine();
  12.             rad = Double.parseDouble(scan.nextLine());
  13.             hig = Integer.parseInt(scan.nextLine());
  14.             volume = Math.PI * rad*rad * hig;
  15.             if (volume>bigVolume){
  16.                 bigVolume=volume;
  17.                 bearNameBig=beerName;
  18.  
  19.             }
  20.             beerNum--;
  21.         }
  22.         System.out.println(bearNameBig);
  23.  
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement