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.

Answered on

Here is a class definition for `PlayListEntry` in the Java programming language:

```java public class PlayListEntry { // Instance variables private String title = ""; private String artist = ""; private int playCount = 0;

// Get method for the title public String getTitle() { return title; }

// Set method for the title public void setTitle(String title) { this.title = title; }

// Get method for the artist public String getArtist() { return artist; }

// Set method for the artist public void setArtist(String artist) { this.artist = artist; }

// Get method for the play count public int getPlayCount() { return playCount; }

// Set method for the play count public void setPlayCount(int playCount) { this.playCount = playCount; } }

Related Questions