Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class absenBonus
- {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- System.out.print("Nama: ");
- String nama = in.nextLine();
- System.out.print("NPM: ");
- int npm = in.nextInt();
- if(npm < 100 || npm > 500 )
- {
- System.out.println(nama + " dengan NPM " + npm + " TIDAK TERDAFTAR");
- System.exit(0);
- }
- else if((npm % 2) == 1)
- {
- System.out.println(nama + " dengan NPM " + npm + " TIDAK TERDAFTAR");
- System.exit(0);
- }
- in.nextLine();
- System.out.print("Jurusan: ");
- String jurusan = in.nextLine();
- if(!jurusan.equalsIgnoreCase("Ilmu Komputer") && !jurusan.equalsIgnoreCase("Sistem Informasi"))
- {
- System.out.println("Jurusan " + jurusan + " TIDAK TERDAFTAR");
- System.exit(0);
- }
- System.out.print("Timestamp : ");
- double timestamp = in.nextDouble();
- double selisih = ((timestamp - 08.00)*100)%100;
- int jam = (int) timestamp-8;
- int waktu = jam * 60 + (int) selisih;
- if(timestamp <= 08.00)
- {
- System.out.println(nama + " dengan NPM " + npm + " TIDAK TERLAMBAT");
- }
- else
- {
- System.out.println(nama + " dengan NPM " + npm + " TERLAMBAT " + waktu + " menit");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement