Advertisement
Kancho

Best_Snowball_New

Feb 28th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 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. int bestSnowBallSnowOutput = 0;
  11.  
  12. int bestSnowBallQualityOutput = 0;
  13.  
  14.  
  15. for (int i = 0; i < n; i++) {
  16. System.out.print("Name: ");
  17. String name = key.nextLine();
  18. System.out.print("snowball snow: ");
  19. int snowBallSnow = Integer.parseInt(key.nextLine());
  20. System.out.print("snowball time: ");
  21. int snowBallTime = Integer.parseInt(key.nextLine());
  22. System.out.print("snowball quality: ");
  23. int snowBallQuality = Integer.parseInt(key.nextLine());
  24.  
  25. double snowBallValue = Math.pow((snowBallSnow / snowBallTime), snowBallQuality);
  26. if (snowBallValue > bestValue) {
  27. bestValue = snowBallValue;
  28. bestSnowBall = name;
  29. bestSnowBallSnowOutput = snowBallSnow;
  30. bestSnowBallQualityOutput = snowBallQuality;
  31. }
  32.  
  33. }
  34. System.out.println("The name of the best snow ball is " + bestSnowBall);
  35. System.out.printf("It has %d snow and %d quality", bestSnowBallSnowOutput, bestSnowBallQualityOutput);
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement