Advertisement
veronikaaa86

02. Cat Walking

Apr 22nd, 2023
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. package examPrep;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02CatWalking {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int minutesPerWalk = Integer.parseInt(scanner.nextLine());
  10.         int countWalks = Integer.parseInt(scanner.nextLine());
  11.         int caloriesPerDay = Integer.parseInt(scanner.nextLine());
  12.  
  13.         int totalMinutes = minutesPerWalk * countWalks;
  14.         int totalBurnedCalories = totalMinutes * 5;
  15.         double halfCalories = caloriesPerDay * 0.5;
  16.  
  17.         if (totalBurnedCalories >= halfCalories) {
  18.             System.out.printf("Yes, the walk for your cat is enough. Burned calories per day: %d.", totalBurnedCalories);
  19.         } else {
  20.             System.out.printf("No, the walk for your cat is not enough. Burned calories per day: %d.", totalBurnedCalories);
  21.         }
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement