Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. public class Track
  2.  
  3. {
  4. private String title;
  5. private int minutes;
  6. private int seconds;
  7.  
  8. public Track (String title, int minutes, int seconds)
  9. {
  10. this.title = title;
  11. this.minutes = minutes;
  12. this.seconds = seconds;
  13. }
  14.  
  15. public String getTitle()
  16. {
  17. return title;
  18. }
  19.  
  20. public String getLength()
  21. {
  22. return (minutes <10 ? "0" + minutes: minutes) + ":" + (seconds <10 ? "0" + seconds: seconds);
  23. }
  24.  
  25. public String toString(String getLength)
  26. {
  27. return title + "(" + getLength + ")";
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement