Advertisement
AntoniiaG

Untitled

Oct 24th, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.16 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.  
  8.         int daysNumber = Integer.parseInt(scan.nextLine());
  9.         double amountRakiaPerDay, degreesPerDay;
  10.         double degreesForL = 0.0;
  11.         double degreesForLPerDay = 0.0;
  12.         double allLitres = 0.0;
  13.  
  14.         for(int i = 1; i <= daysNumber; i++){
  15.             amountRakiaPerDay = Double.parseDouble(scan.nextLine());
  16.             degreesPerDay = Double.parseDouble(scan.nextLine());
  17.             allLitres += amountRakiaPerDay;
  18.             degreesForLPerDay += amountRakiaPerDay * degreesPerDay;
  19.         }
  20.         degreesForL = degreesForLPerDay/allLitres;
  21.         System.out.printf("Liter: %.02f\n", allLitres);
  22.         System.out.printf("Degrees: %.2f\n", degreesForL);
  23.         if(degreesForL < 38){
  24.             System.out.println("Not good, you should baking!");
  25.         }
  26.         else if(degreesForL >= 38 && degreesForL <= 42){
  27.             System.out.println("Super!");
  28.         }
  29.         else if (degreesForL > 42){
  30.             System.out.println("Dilution with distilled water!");
  31.         }
  32.  
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement