Advertisement
Guest User

Untitled

a guest
Mar 21st, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.text.NumberFormat;
  2.  
  3. //Modified by Brian Carey
  4. public class DVD
  5. {
  6. private String title, director;
  7. private int year;
  8. private double cost;
  9. private boolean bluRay;
  10.  
  11. public DVD(String title, String director, int year, double cost,
  12. boolean bluRay)
  13. {
  14. this.title = title;
  15. this.director = director;
  16. this.year = year;
  17. this.cost = cost;
  18. this.bluRay = bluRay;
  19. }
  20. public String toString()
  21. {
  22. NumberFormat fmt = NumberFormat.getCurrencyInstance();
  23.  
  24. String description;
  25.  
  26. description = fmt.format(cost) + "\t" + year + "\t";
  27. description += title + "\t" + director;
  28.  
  29. if (bluRay)
  30. description += "\t" + "Blu-Ray";
  31.  
  32. return description;
  33. }
  34. public String getDirector()
  35. {
  36. return director;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement