desislava_topuzakova

01. Honeycombs

Jun 10th, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Honeycombs_01 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int countBees = Integer.parseInt(scanner.nextLine());
  7.         int countFlowers = Integer.parseInt(scanner.nextLine());
  8.  
  9.         double totalGramsHoney = 0.21 * countBees * countFlowers;
  10.         double countHoneyPie = Math.floor(totalGramsHoney / 100);
  11.         double leftHoney = totalGramsHoney - countHoneyPie * 100;
  12.  
  13.         System.out.printf("%.0f honeycombs filled.%n", countHoneyPie);
  14.         System.out.printf("%.2f grams of honey left.", leftHoney);
  15.     }
  16. }
Add Comment
Please, Sign In to add comment