Advertisement
paykova

Grandpa Stavri

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