Advertisement
Venciity

[SoftUni Java] ExamPreparation 01.WorkHours by Alex

May 20th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. package Exams;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class WorkHours {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner input = new Scanner(System.in);
  9.         int h = input.nextInt();
  10.         int d = input.nextInt();
  11.         Double p = input.nextDouble() / 100;
  12.        
  13.         double availableDays = d - (0.1 * d);
  14.         double workingTime = availableDays * 12;
  15.         int totalTime = (int)(workingTime * p);
  16.        
  17.         int diff = (int)(totalTime - h);
  18.        
  19.         if (diff >= 0) {
  20.             System.out.println("Yes");
  21.             System.out.println(diff);
  22.         }
  23.         else if (diff < 0) {
  24.             System.out.println("No");
  25.             System.out.println(diff);
  26.         }
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement