Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.  
  6.         Scanner scanner = new Scanner(System.in);
  7.         int amountBiscuits = Integer.parseInt(scanner.nextLine());
  8.         int countWorkers = Integer.parseInt(scanner.nextLine());
  9.         int biscuits30Days = Integer.parseInt(scanner.nextLine());
  10.         double percents = 0.0;
  11.         double productionOfMonth = 0.0;
  12.         for (int i = 1; i <= 30; i++) {
  13.             if (i % 3 == 0) {
  14.                 productionOfMonth += Math.floor(0.75 * amountBiscuits * countWorkers);
  15.             } else {
  16.                 productionOfMonth += amountBiscuits * countWorkers;
  17.             }
  18.         }
  19.         System.out.println(String.format("You have produced %.0f biscuits for the past month.", productionOfMonth));
  20.  
  21.         if (productionOfMonth >= biscuits30Days) {
  22.             percents = ((productionOfMonth - biscuits30Days) / biscuits30Days) * 100;
  23.             System.out.println(String.format("You produce %.2f percent more biscuits.", percents));
  24.         } else {
  25.             percents = ((biscuits30Days - productionOfMonth) / biscuits30Days) * 100;
  26.             System.out.println(String.format("You produce %.2f percent less biscuits.", percents));
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement