Advertisement
Spocoman

AND Processors

Sep 1st, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int neededProcessors = Integer.parseInt(scanner.nextLine()),
  7.                 workers = Integer.parseInt(scanner.nextLine()),
  8.                 days = Integer.parseInt(scanner.nextLine()),
  9.                 workingHoursPerDay = 8, processorBuildHours = 3;
  10.         double processorPrice = 110.10,
  11.                 diff = (neededProcessors - Math.floor(1.0 * workers * days * workingHoursPerDay / processorBuildHours)) * processorPrice;
  12.  
  13.         if (diff > 0) {
  14.             System.out.printf("Losses: -> %.2f BGN\n", diff);
  15.         } else {
  16.             System.out.printf("Profit: -> %.2f BGN\n", Math.abs(diff));
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement