ArrayList Objective: Create a Java program that models a music playlist, demonstrating the student's understanding of objects
Question:
ArrayList
Objective: Create a Java program that models a music playlist, demonstrating the student's understanding of objects and ArrayList.
Related SLOs:
SLO #1: Use an appropriate programming environment to design, code, compile, run, and debug computer programs.
SLO #2: Demonstrate basic problem solving skills: analyzing problems, modeling a problem as a system of objects, creating algorithms, and implementing models and algorithms in an object-oriented computing language.
SLO #3: Illustrate basic programming concepts such as program flow and syntax of a high-level general-purpose language and basic security practices.
SLO #4: Demonstrate working with primitive data types, strings, and arrays.
Instructions:
Create a program that will model a music playlist by using an ArrayList that holds Song objects.
Using jGRASP, write a Java program named LastnameFirstname11.java, using your last name and your first name, that does the following:
Uses an ArrayList to model a music playlist.
Uses Song objects to represent songs in the playlist, with the following data:
Title
Artist
Minutes
Seconds
Note: Your toString should print minutes and seconds together (see possible examples below in the Expected Output section)
Passes the ArrayList to the printPlaylist method. This method prints out the ArrayList in order, with Song objects separated so their information is easy to read (see Expected Output below)
In other words, do not simply use System.out.println(nameOfYourArrayList)
Hint: use a loop, similar to the way you printed out an array.
Your program MUST:
Create at least 5 Song objects, all with valid data
Store the Song objects in an ArrayList
Use the printPlaylist method to print out the data for all Song objects in your ArrayList in a neatly arranged format
Do not simply use System.out.print(yourArrayList)
Actively use in-line comments stating what each section of code does.
Use try/catch if, and only if, necessary.
Your program must conform to the Java coding standards reviewed in class during Week 3.
Your program should not use code/concepts we have not yet covered. You must demonstrate that you have mastered the concepts covered in class.
Remember to always begin your code with the following documentation comments:
/**
* Short description of the program.
*
* @author Doe, John
* @assignment ICS 555 Assignment 11
* @date March 14, 2024
* @bugs Short description of bugs in the program, if any.
*/
Expected Output:
This is an example of what your program should output:
Note: these are from two ArrayLists and using Song1 and Song2 objects, just to give you ideas of how you might want to format your output (the Song1 and Song2 classes each have different toString() outputs). You only need 1 ArrayList and 1 Song class, and you can format your output however you'd like!
----jGRASP exec: java DoeJohn11
*** My 2am Playlist ***
"Solitude" by re:plus (4:16)
"Paris in the Rain" by Lauv (3:24)
"in your arms" by Saib (4:37)
"Enamored" by Ibrahim (feat. Limes) (2:47)
"Spending Late Nights with You" by Rook1e (feat. Aimless) (1:36)
"Kimi no Toriko (remix)" by Heiakim (2:55)
*** My Driving Playlist ***
Song 1:
"Body" by Loud Luxury, Brando
2 minutes 43 seconds
Song 2:
"Worship" by MAX
3 minutes 8 seconds
Song 3:
"Say So" by Doja Cat
3 minutes 58 seconds
Song 4:
"Foreplay" by Jalen Santoy
2 minutes 54 seconds
Song 5:
"South" by Galimatias
3 minutes 35 seconds
Song 6:
"Fly - FKJ Remix" by June Marieezy, FKJ
4 minutes 12 seconds
----jGRASP: operation complete.
Criteria:
-The program compiles and output is incorrect.
-ArrayList implementation
-Object class
-Use conditionals, loops, arrays, or methods if possible
-Include documentation comments, follow the specified format
-No miscellaneous mistakes, bugs, or problems.
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch