borkins

Exam 06-Mar-2016 - 01. Training Lab

May 14th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. /**
  2.  * Project: Exam_06_March_2016 - created by borkins on 2017-05-14.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _01_TrainingLab
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.    
  13.         double h = Double.parseDouble(console.nextLine());
  14.         double w = Double.parseDouble(console.nextLine());
  15.    
  16.         // Values in centimeters
  17.         int corridorWidth = 100;
  18.         int workplaceWidth = 70;
  19.         int workplaceLength = 120;
  20.         h *= 100; // width (cm)
  21.         w *= 100; // length (cm)
  22.        
  23.         int workplacesPerRow = (int) Math.floor((w - corridorWidth) / workplaceWidth);
  24.         int rows = (int) Math.floor(h / workplaceLength);
  25.         int workplaces = (workplacesPerRow * rows) - 3;
  26.    
  27.         System.out.println(workplaces);
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment