Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. public class DVD
  2. {
  3.     private String title;
  4.     private String director;
  5.     private int playingTime;
  6.     private boolean gotIt;
  7.     private String comment;
  8.    
  9.     public DVD (String theTitle, String theDirector, int time)
  10.     {
  11.         title = theTitle;
  12.         director = theDirector;
  13.         playingTime = time;
  14.         comment = "<no comment>";
  15.     }
  16.  
  17.     public void setComment (String comment)
  18.     {
  19.         this.comment = comment;
  20.     }
  21.     public String getComment ()
  22.     {
  23.         return comment;
  24.     }
  25.     public void setOwn (boolean ownIt)
  26.     {
  27.         gotIt = ownIt;
  28.     }
  29.    
  30.     public boolean getOwn()
  31.     {
  32.         return gotIt;
  33.     }
  34.    
  35.     public void print()
  36.     {
  37.         System.out.print("DVD: " + title + " (" + playingTime + " minsl");
  38.         if(gotIt)
  39.         {
  40.             System.out.println("*");
  41.         }
  42.         else
  43.         {
  44.             System.out.println();
  45.         }
  46.         System.out.println("    " + director);
  47.         System.out.println("    " + comment);
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement