Advertisement
dimipan80

C#Exams 1. Work Hours (on Java Code)

Aug 21st, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class _1_WorkHours {
  4.  
  5.     public static void main(String[] args) {
  6.         // TODO Auto-generated method stub
  7.         Scanner scan = new Scanner(System.in);
  8.         int projectHours = scan.nextInt();
  9.         int availableDays = scan.nextInt();
  10.         int averageProductivity = scan.nextInt();
  11.  
  12.         double allHours = availableDays * 12;
  13.         double workHours = allHours * 0.9;
  14.         workHours *= ((double) averageProductivity / 100);
  15.         int totalWorkHours = (int) workHours;
  16.  
  17.         int difference = totalWorkHours - projectHours;
  18.         if (difference >= 0) {
  19.             System.out.println("Yes\n" + difference);
  20.         } else {
  21.             System.out.println("No\n" + difference);
  22.         }
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement