desislava_topuzakova

08. Cinema Ticket

Sep 25th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CinemaTicket_08 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. int number = Integer.parseInt(scanner.nextLine());
  7.  
  8.  
  9. double biggestVolume = Double.MIN_VALUE;
  10. String biggestModel = "";
  11.  
  12. for (int i = 0; i < number; i++) {
  13. String Model = scanner.nextLine();
  14. double Radius = Double.parseDouble(scanner.nextLine());
  15. int Height = Integer.parseInt(scanner.nextLine());
  16. double Volume = Math.PI * Math.pow(Radius, 2) * Height;
  17.  
  18. if(Volume> biggestVolume){
  19. biggestVolume=Volume;
  20. biggestModel=Model;
  21. }
  22. }
  23. System.out.println(biggestModel);
  24. }
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment