Write the definition of a class PlayListEntry containing: An instance variable title of type String, initialized to the empty String. An instance variable artist of type String, initialized to the empty String. An instance variable playCount of type int, initialized to 0. In addition, your PlayList class definition should provide an appropriately named “get” method and “set” method for each of these. No constructor need be defined.

LANGUAGE: JAVA

CHALLENGE:

Write the definition of a class PlayListEntry containing:
An instance variable title of type String, initialized to the empty String.
An instance variable artist of type String, initialized to the empty String.
An instance variable playCount of type int, initialized to 0.
In addition, your PlayList class definition should provide an appropriately named “get” method and “set” method for each of these.
No constructor need be defined.

SOLUTION:

public class PlayListEntry{
   private String title = "";
   private String artist = "";
   private int playCount = 0;
   public void setTitle(String theTitle){
      title = theTitle;
   }

   public void setArtist(String theArtist){
      artist = theArtist;
   }

   public void setPlayCount(int thePlayCount){
      playCount = thePlayCount;
   }

   public String getTitle(){
      return title;
   }

   public String getArtist(){
      return artist;
   }

   public int getPlayCount(){
      return playCount;
   }
}