YavorGrancharov

ExamTask2(Cups)

Mar 19th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ExamTask2 {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         int cups = Integer.parseInt(console.nextLine());
  7.         int workers = Integer.parseInt(console.nextLine());
  8.         int laborDays = Integer.parseInt(console.nextLine());
  9.  
  10.         int cupHours = 5;
  11.         int laborHours = 8;
  12.         double cupPrice = 4.20;
  13.  
  14.         double hoursWork = (workers * laborHours) * laborDays;
  15.         double numCupsFinished = Math.floor(hoursWork / 5);
  16.  
  17.         double price = 0.0;
  18.         if(numCupsFinished > cups) {
  19.             price = (numCupsFinished - cups) * 4.20;
  20.             System.out.printf("%.2f%s", price, " extra money");
  21.         } else {
  22.             price = (cups - numCupsFinished) * 4.20;
  23.             System.out.printf("Losses: %.2f", price);
  24.         }
  25.     }
  26. }
Add Comment
Please, Sign In to add comment