Pseudo Code:
Program Form_ Kartu_ Perpustakaan
{Program mengenai pengisian form kartu perpustakaan}
Input: nama, nim,
jk, jurusan, alamat, judul buku, masa berlaku
Declaration:
{nama, nim, jk, jurusan, alamat, masaberlaku: char}
Description:
Begin
Begin
Writeln (“Nama: ”);
Read (nama);
Writeln (“NIM: ”);
Read (nim);
Writeln (“ Gender: ”);
Read (jk);
Writeln (“Alamat: ”);
Read (alamat);
Writeln (“Jurusan: ”);
Read (jurusan);
Writeln(“Masa Berlaku:”);
Read(masaberlaku);
Println (“KARTU PERPUSTAKAAN FAKULTAS TEKNIK 2014”);
Println (nama);
Println (nim);
Println (jk);
Println (jurusan);
Println (alamat);
Println (masaberlaku);
End
1. Buka program Eclipse
2. Klik File-New-Java Project, lalu beri nama java project tersebut
3. Klik pada folder Java project tersebut, lalu klik kanan new-package
4. Klik pada package yang telah kita buat lalu klik kanan new-class, jangan lupa centang public static void main(String[] args) pada which method stubs would you like to create?
5. Jika sudah masuk ke editor, tuliskan listing seperti dibawah ini
package Kartuperpus;
import java.util.Scanner;
public class Kartuperpus2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner ok = new Scanner(System.in);
String nama,nim,jk,alamat,jurusan,buku,masaberlaku;
System.out.print("Nama : ");
nama=ok.nextLine();
System.out.print("NIM : ");
nim=ok.nextLine();
System.out.print("Gender : ");
jk=ok.nextLine();
System.out.print("Alamat : ");
alamat=ok.nextLine();
System.out.print("Jurusan : ");
jurusan=ok.nextLine();
System.out.print("Tanggal Pendaftaran : ");
masaberlaku=ok.nextLine();
System.out.println("");
System.out.println("SELAMAT ANDA TELAH MEMPUNYAI KARTU PERPUSTAKAAN FAKULTAS TEKNIK 2014");
System.out.println("----------------------------------------");
System.out.println("| KARTU PERPUSTAKAAN |");
System.out.println("| FAKULTAS TEKNIK |");
System.out.println("| 2014 |");
System.out.println("----------------------------------------");
System.out.println("|Nama : " +nama.substring(0,11)+" |");
System.out.println("|NIM : "+nim.substring(0,14)+" |");
System.out.println("|Jenis Kelamin : "+jk.substring(0,1)+" |");
System.out.println("|Alamat : "+alamat.substring(0,8)+" |");
System.out.println("|Jurusan : "+jurusan.substring(0,15)+" |");
System.out.println("|Masa berlaku : "+masaberlaku+" 2015 |");
System.out.println("----------------------------------------");
}
}
8. Selesai
0 komentar:
Posting Komentar