Question
This is all supposed to be written in Java. This is the Music.Java file public class Music { // instance variables private int year; private
This is all supposed to be written in Java.
This is the Music.Java file
public class Music { // instance variables private int year; private String title; private String artist;
// Constructor for objects of class Music public Music(String t, int y, String a) { // initialize instance variables title = t; year = y; artist = a; }
public String getTitle() { return title; } public void setTitle(String t) { title = t; } public String getArtist() { return artist; } public void setArtist(String a) { artist = a; } public int getYear() { return year; } public void setTitle(int y) { year = y; } public String toString() { String str = String.format( "%-25s %4d %-20s ", title, year , artist); return str; } }
This is the Grading Rubric.
Instructions: For this assignment, you will create several sequential search methods and perform the searches using a collection of music. 1. Create a new project called 08.01 Assignment in your Module 08 assignment folder. 2. Download the Music.java file to the newly-created folder. a. Observe the instance variables year, title, and artist. b. A constructor is provided. c. Getter and setter methods are provided, as well as a toString method. 3. For this project, you will create a tester class that declares an array of Music objects to use with the search methods. Decide on a class name and then append V1 to the end to help organize your classes. 4. Declare an array of at least 10 Music objects. For each, you will need a song title, year, and artist name. At least one year needs to have multiple entries in the array. Same with one of the artists. Of course, be sure to use school- appropriate songs. For example: Livin' on a Prayer, 1986, Bon Jovi 5. Design a static method that traverses through the array and prints each element. 6. Create the following static methods in the tester class. Utilize the sequential search algorithm. Each method will take two arguments, the array and the value to find. a. a method that searches the array for a particular song title b. a method that searches the array for year released (the output should list all songs found from that year) c. a method that searches the array for the name of the artist (the output should list all songs performed by that artist) 7. Test your search methods by calling each and displaying the results. Start by showing the original array. Then demonstrate searching for a title, showing results when a title is found and when not found. Do the same for year and artist. Include searches that should find more than one match. Be sure to clearly label your output so someone looking at it knows which search criterion was applied each time. 08.01 Sequential Search Grading Rubric Points Possible Points Earned Components Comments included for name, date, and purpose of the program. 1 Create a tester class with an array of Music objects. 2 Create a method to print all the Music objects in the array. 1 Create a selection search method to find a title. 3 Create a selection search method to find all instances of a year. 3 Create a selection search method to find all instances of an artist. 3 Search methods invoked and run properly when search criterion is found and not found. For year and artist, all instances are reported. 2 Output is clearly labeled, formatted, and accurate. 2 No compiler errors. No runtime errors. 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started