Advertisement
desislava_topuzakova

02. Cat Walking

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