Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class P2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int burnedCaloriesPerMinute = 5;
- //На първия ред - минути разходка на ден - цяло число в интервала [1...50]
- int walkInMinutesPerDay = Integer.parseInt(scanner.nextLine());
- //На втория ред - броят на разходките дневно - цяло число в интервала [1…10]
- int numberOfWalksPerDay = Integer.parseInt(scanner.nextLine());
- //На третия ред - приетите от котката калории на ден – цяло число в интервала [100…4000]
- int caloriesIntakePerDay = Integer.parseInt(scanner.nextLine());
- int totalWalk = numberOfWalksPerDay * walkInMinutesPerDay;
- int totalBurnedCalories = totalWalk * burnedCaloriesPerMinute;
- double enoughBurnedCalories = 0.5 * caloriesIntakePerDay;
- if ( totalBurnedCalories >= (int)enoughBurnedCalories) {
- System.out.printf("Yes, the walk for your cat is enough. Burned calories per day: %d.", totalBurnedCalories);
- } else {
- System.out.printf("No, the walk for your cat is not enough. Burned calories per day: %d.", totalBurnedCalories);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement