Modul 1. lat4

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package perpustakaan;

/**
 *
 * @author LABOR MAT
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        BufferedReader InputData = new BufferedReader (new InputStreamReader(System.in));
        String NoPinjam="";
        String NamaAng="";
        String TglP ="";
        String TglT ="";
        String TglK ="";
        String Denda="";
        int JumDenda =0;
                        
        System.out.println("Inputkan No Pinjam =");
        try{
            NoPinjam = InputData.readLine();
        }catch(IOException e){
            System.out.println("Error");
        }
        if (NoPinjam.equals("AAA"))
            System.out.println("Benar");
        else
            System.out.println("Salah");
        System.out.println("Input Nama Anggota =");
        try{
            NamaAng = InputData.readLine();
        }catch(IOException e){
            System.out.println("Error");
        }
        System.out.println("Tanggal Pinjam =");
        try{
            TglP = InputData.readLine();
        }catch(IOException e){
            System.out.println("Error");
        }
        System.out.println("Tanggal Kembali =");
        try{
            TglK = InputData.readLine();
        }catch(IOException e){
            System.out.println("Error");
        }
        
        System.out.println("Denda =");
        try{
            Denda = InputData.readLine();
        }catch(IOException e){
            System.out.println("Error");
        }
        String TglPP = TglP.substring(0,2);
        String TglKK = TglK.substring(0,2);
        System.out.println(TglPP);
        System.out.println(TglKK);
        int TglK1 = Integer.valueOf(TglKK).intValue();
        int TglP1 = Integer.valueOf(TglPP).intValue();
        int TglT1 =  TglP1 + 5;
        String TglT2 = String.valueOf(TglT1);
        String TglT3 = TglT2 + TglP.substring(2,8);
        int Denda1 = Integer.valueOf(Denda).intValue();
        if (TglK1 > TglT1)
            JumDenda = (TglK1 - TglT1) * Denda1;
        else
            JumDenda =0;
        System.out.println("Tanggal Tempo: "+TglT3);
        System.out.println("Denda adalah : "+JumDenda);   
    }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: