Advertisement
TheSTRIG

absen dhana

Sep 30th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class absenBonus
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner in = new Scanner(System.in);
  8.            
  9.         System.out.print("Nama: ");
  10.         String nama = in.nextLine();
  11.        
  12.             System.out.print("NPM: ");
  13.             int npm = in.nextInt();
  14.             if(npm < 100 || npm > 500 )
  15.             {
  16.                 System.out.println(nama + " dengan NPM " + npm + " TIDAK TERDAFTAR");
  17.                 System.exit(0);
  18.             }
  19.             else if((npm % 2) == 1)
  20.             {
  21.                 System.out.println(nama + " dengan NPM " + npm + " TIDAK TERDAFTAR");
  22.                 System.exit(0);
  23.             }
  24.        
  25.         in.nextLine();
  26.  
  27.        
  28.             System.out.print("Jurusan: ");
  29.             String jurusan = in.nextLine();
  30.             if(!jurusan.equalsIgnoreCase("Ilmu Komputer") && !jurusan.equalsIgnoreCase("Sistem Informasi"))
  31.             {
  32.                 System.out.println("Jurusan " + jurusan + " TIDAK TERDAFTAR");
  33.                 System.exit(0);
  34.             }
  35.        
  36.        
  37.        
  38.             System.out.print("Timestamp : ");
  39.             double timestamp = in.nextDouble();
  40.             double selisih = ((timestamp - 08.00)*100)%100;
  41.             int jam = (int) timestamp-8;
  42.             int waktu = jam * 60 + (int) selisih;
  43.            
  44.             if(timestamp <= 08.00)
  45.             {  
  46.                 System.out.println(nama + " dengan NPM " + npm + " TIDAK TERLAMBAT");
  47.             }
  48.             else
  49.             {
  50.                 System.out.println(nama + " dengan NPM " + npm + " TERLAMBAT " + waktu + " menit");
  51.             }
  52.        
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement