Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /**
  2. * Created by Inan on 18/03/2018.
  3. */
  4. public class Playlist {
  5.  
  6.  
  7.  
  8.  
  9. private int n;
  10. private Song [] songs;
  11.  
  12.  
  13. Playlist(int amount){
  14.  
  15. this.songs = new Song[amount];
  16. this.n = 0;
  17.  
  18. }
  19.  
  20. Playlist( , double length){
  21.  
  22. }
  23.  
  24.  
  25. public void add(Song song){
  26. songs[n] = song;
  27. n++;
  28.  
  29. }
  30.  
  31. double getLaenge(){
  32. double sum = 0;
  33.  
  34. for (int i = 0; i <= n-1 ; i++) {
  35. sum = sum + songs[i].getLaenge();
  36.  
  37. }
  38. return sum;
  39. }
  40.  
  41. public void print(){
  42. for (int i = 0; i <= n-1 ; i++) {
  43. songs[i].print();
  44. }
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement