reyhanzo

Untitled

Dec 17th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. public class CD extends Item
  2. {
  3.     private String artist;
  4.     private int numberoftracks;
  5.     public CD(String title, int playingtime, String artist, int numberoftracks) //constructor
  6.     {
  7.         super(title,playingtime);
  8.         this.artist=artist;
  9.     }
  10.      
  11.     public void setComment(String comment) //method untuk memasukkan comment CD
  12.     {
  13.         super.setComment(comment);
  14.     }
  15.     public void setGotIt(boolean gotit) //method untuk memasukkan nilai ketersediaan CD
  16.     {
  17.         super.setGotIt(gotit);
  18.     }
  19.     public String getArtist() //method untuk return nama artist
  20.     {
  21.         return artist;
  22.     }
  23.     public int getNumber() //method untuk return jumlah tracks
  24.     {
  25.         return numberoftracks;
  26.     }
  27.     public void printArtist() //method untuk mencetak nama artist
  28.     {
  29.         System.out.println("Artist: " + artist);
  30.     }
  31. }
Add Comment
Please, Sign In to add comment