Advertisement
Kancho

Best_Snowball

Feb 27th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Soft_Uni_Varibles {
  4. public static void main(String[] args) {
  5. Scanner key = new Scanner(System.in);
  6. System.out.println("n: ");
  7. int n = Integer.parseInt(key.nextLine());
  8. double bestValue = 0;
  9. String bestSnowBall = "";
  10. for (int i = 0; i < n; i++) {
  11. System.out.print("Name: ");
  12. String name = key.nextLine();
  13. System.out.print("snowball snow: ");
  14. int snowBallSnow = Integer.parseInt(key.nextLine());
  15. System.out.print("snowball time: ");
  16. int snowBallTime = Integer.parseInt(key.nextLine());
  17. System.out.print("snowball quality: ");
  18. int snowBallQuality = Integer.parseInt(key.nextLine());
  19.  
  20. double snowBallValue = Math.pow((snowBallSnow / snowBallTime), snowBallQuality);
  21. if (snowBallValue > bestValue) {
  22. bestValue = snowBallValue;
  23. bestSnowBall = name;
  24.  
  25.  
  26. }
  27.  
  28. }
  29. System.out.println("The name of the best snow ball is " + bestSnowBall);
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement