Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package IZPIT;
- import java.util.Scanner;
- public class Cat_Diet {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double percentMas = Integer.parseInt(scan.nextLine());
- double percentPro = Integer.parseInt(scan.nextLine());
- double percentCoals = Integer.parseInt(scan.nextLine());
- double totalCalories = Integer.parseInt(scan.nextLine());
- double percentWat = Integer.parseInt(scan.nextLine());
- double gramMas = (percentMas * totalCalories / 100) /9 ;
- double gramPro = (percentPro * totalCalories / 100) /4;
- double gramCoal = (percentCoals * totalCalories / 100) /4 ;
- double gram = gramCoal + gramMas + gramPro;
- double calPerGram = totalCalories / gram;
- double calories = calPerGram - (percentWat / 100 * calPerGram);
- System.out.printf("%.4f",calories);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement