Advertisement
Spocoman

Grandpa Stavri

Sep 7th, 2024
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int days = Integer.parseInt(scanner.nextLine());
  7.         double currentLiters, currentGradus, averageGradus = 0, totalLiters = 0;
  8.  
  9.         for (int i = 0; i < days; i++) {
  10.             currentLiters = Double.parseDouble(scanner.nextLine());
  11.             currentGradus = Double.parseDouble(scanner.nextLine());
  12.             averageGradus += currentLiters * currentGradus;
  13.             totalLiters += currentLiters;
  14.         }
  15.  
  16.         averageGradus /= totalLiters;
  17.  
  18.         System.out.printf("Liter: %.2f\nDegrees: %.2f\n", totalLiters, averageGradus);
  19.  
  20.         if (averageGradus < 38) {
  21.             System.out.println("Not good, you should baking!");
  22.         } else if (averageGradus > 42) {
  23.             System.out.println("Dilution with distilled water!");
  24.         } else {
  25.             System.out.println("Super!");
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement