Advertisement
NB52053

// Mid 17_Qustn 6 (b)

Jul 18th, 2017
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. /**
  2.  * Created by ltnb on 7/18/17.
  3.  */
  4. public class Songplayer extends Song{
  5.  
  6.  
  7.     public Songplayer(String name, double duration, String lyrics) {
  8.         super(name, duration, lyrics);
  9.     }
  10.  
  11.     public static void main(String[] args) {
  12.  
  13.             Album album = new Album("Shironamhin","Bondho Janala");
  14.             Song s1 = new Song("Tuhin", 4, "Sara bela bondho janala");
  15.             album.addToAlbum(s1);
  16.  
  17.             s1 = new Song("Tuhin, Zia", 4.2, "Megh jhore jhore bristy naame");
  18.             album.addToAlbum(s1);
  19.        
  20.             s1 = new Song("Tuhin",   4.3,  "TSC er chottor, bullet kingba kobita");
  21.             album.addToAlbum(s1);
  22.  
  23.             System.out.println("Album Info");
  24.             System.out.println(album.getInfo());
  25.             obj.printSongList();
  26.  
  27.  
  28.     }
  29.  
  30. }
  31.  
  32.  
  33.  
  34.      class Album {
  35.  
  36.  
  37.  
  38.             public Album(String BandName, String AlbumName){
  39.  
  40.                     BandName = BandName;
  41.                     AlbumName = AlbumName;
  42.             }
  43.  
  44.  
  45.          public void addToAlbum(Song s1) {
  46.              
  47.          }
  48.      }
  49.  
  50.  
  51. class Song {
  52.  
  53.     public String name, lyrics;
  54.     public double duration;
  55.  
  56.  
  57.     public Song(String name, double duration, String lyrics) {
  58.         this.name = name;
  59.         this.lyrics = lyrics;
  60.         this.duration = duration;
  61.     }
  62.  
  63.     public static void play(Song s1) {
  64.  
  65.         System.out.println(s1.lyrics);
  66.     }
  67.  
  68.     public String getInfo() {
  69.  
  70.         System.out.printf("Song{Singer Name: %s , duration = %.2f }", name, duration);
  71.  
  72.         return " ";
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement