Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Soft_Uni_Varibles {
- public static void main(String[] args) {
- Scanner key = new Scanner(System.in);
- System.out.println("n: ");
- int n = Integer.parseInt(key.nextLine());
- double bestValue = 0;
- String bestSnowBall = "";
- for (int i = 0; i < n; i++) {
- System.out.print("Name: ");
- String name = key.nextLine();
- System.out.print("snowball snow: ");
- int snowBallSnow = Integer.parseInt(key.nextLine());
- System.out.print("snowball time: ");
- int snowBallTime = Integer.parseInt(key.nextLine());
- System.out.print("snowball quality: ");
- int snowBallQuality = Integer.parseInt(key.nextLine());
- double snowBallValue = Math.pow((snowBallSnow / snowBallTime), snowBallQuality);
- if (snowBallValue > bestValue) {
- bestValue = snowBallValue;
- bestSnowBall = name;
- }
- }
- System.out.println("The name of the best snow ball is " + bestSnowBall);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement