Selasa, 07 Mei 2013

Netbens-Menampilkan informasi Buku beserta ISBN dari buku yang diterbitkan (Part2)


Buat Class baru :
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package myinterface;
import java.util.Scanner;

/**
 *
 * @author Acer
 */
class Demo{
    public static void main (String[] args) {
        Scanner masukan = new Scanner(System.in);
        String ISBN="979-300-100-3";
        Univ Pewaris = new Univ();
        System.out.println("======Program menampilkan informasi Buku======");
        Pewaris.nama="Bella Yulianita";
        Pewaris.jenis="Pemrograman java";
        Pewaris.judul="Rahasia Java";
        Pewaris.ukuran="15x23cm";
        Pewaris.tebal="100 lembar";
        Pewaris.cover="paperback";
        Pewaris.tanggal="02-01-1995";
        Pewaris.ISBN="97-300-100-3";
        Pewaris.Identitas( );
    }
}



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

/**
 *
 * @author Acer
 */
class Pewaris extends Univ{
    Pewaris(String nama) {
        this.nama = nama;
        this.jenis = jenis;
        this.judul = judul;
    }
}

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

/**
 *
 * @author Acer
 */
class Univ implements myInterFace
{
    protected String nama,judul,jenis,ukuran,tebal,cover,tanggal,ISBN;
    
    public void Identitas( ){
        System.out.println("Identitas Buku\nPenulis\t :"+nama1( )+"\nJenis\t :"+nama2()+"\nJudul\t :"+nama3()+"\nUkuran\t :"+nama4()+"\nTebal\t :"+nama5()+"\nCover\t :"+nama6()+"\nTanggal Terbit:"+nama7()+"\n ISBN:"+nama8());
}
    public String nama1( ){
        return nama;
    }
    public String nama2( ){
        return jenis;
    }
    public String nama3( ){
        return judul;
    }
    public String nama4( ){
        return ukuran;
    }
    public String nama5( ){
        return tebal;
    }
    public String nama6( ){
        return cover;
    }
    public String nama7( ){
        return tanggal;
    }
    public String nama8( ){
        return ISBN;
}}

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

/**
 *
 * @author Acer
 */
interface myInterFace {
    void Identitas( );
}

0 komentar:

Posting Komentar

© Bella Yulianita 2012 | Blogger Template by Enny Law - Ngetik Dot Com - Nulis