/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package buku;
/**
*
* @author ASPIRE 4752
*/
public class Buku {
private String judul;
private String penulis;
private int jumlah_halaman;
private int pilihan;
private int data_book;
public String getJudul() {
return judul;
}
public void setJudul(String judul) {
this.judul = judul;
}
public String getPenulis() {
return penulis;
}
public void setPenulis(String penulis) {
this.penulis = penulis;
}
public int getJumlah_halaman() {
return jumlah_halaman;
}
public void setJumlah_halaman(int jumlah_halaman) {
this.jumlah_halaman = jumlah_halaman;
}
public int getPilihan() {
return pilihan;
}
public void setPilihan(int pilihan) {
this.pilihan = pilihan;
}
public int getData_book() {
return data_book;
}
public void setData_book(int data_book) {
this.data_book = data_book;
}
}
class kedua (Admin)
package buku;
import java.util.Scanner;
/**
*
* @author ASPIRE 4752
*/
public class Admin {
Scanner scan = new Scanner(System.in);
int data_book = scan.nextInt();
String judul[]=new String[data_book];
String penulis[]=new String[data_book];
int jumlah_halaman[]=new int[data_book];
public void input(){
for(int i=1; i<=data_book; i++){
System.out.println("Buku ke : "+i);
System.out.print("Judul : ");
judul[i-1] = scan.next();
System.out.print("Penulis : ");
penulis[i-1] = scan.next();
System.out.print("Jumlah halaman : ");
jumlah_halaman[i-1] = scan.nextInt();
System.out.println();
}
}
public void tampil(){
System.out.println("Semua Data Buku");
System.out.println("==============================");
for (int i=1; i<=data_book; i++){
System.out.println(i+ "\t Judul : " +judul[i-1]+"\n \t Penulis : "+penulis[i-1]+"\n \t Jumlah Halaman : "+jumlah_halaman[i-1]+"\n");
System.out.println("==============================");
}
}
}
class ketiga(Bukutest)
package buku;
/**
*
* @author ASPIRE 4752
*/
public class Bukutest {
public static void main(String[]args){
Admin admin_book = new Admin();
admin_book.input();
admin_book.tampil();
}
}
0 komentar:
Posting Komentar