8.1.1. WrClasses-WE1-P1

Subgoals for Writing a Class 1/4

  1. Name it

  2. Differentiate class-level (static) vs. instance/object-level variables

  3. Differentiate class-level (static) vs. instance/object behaviors/methods

  4. Define class variables (static) as needed ‘

    1. Name

    2. Data Type

    3. public / private / final

  5. Define instance variables (that you want to be interrelated)

    1. Name

    2. Data Type

    3. private


Consider writing a class to represent a song on your phone or music player. You need to define the appropriate attributes (data) to store the name of the song, the artist, and length. All songs should be stored in the same format, which should be MP3.

Complete the following class skeleton.

public class SongType {
   ___A___ ___B___ title;
   ___C___ ___D___ artist;
   ___E___ ___F___ length;
   ___G___ ___H___ final String FORMAT = "MP3";
You have attempted of activities on this page