I need help for my Java homework

CSIT 254 Programming Lab 2 – Java ReviewOverview
This lab is meant to be an overview of Java, specifically Array of Objects, while loops, for loops, if, printf
Using your Song class from Programming Lab 01, create an array of Song and fill it by prompting the user
for one song at a time. Use a sentinel of XXX for the Song Title to end the input.
After the input is done, either display a note that no songs were entered or display the list of songs.
You need to complete Lab1 before moving on to Lab2.
Hint(s)
See page 3 for a sample array declaration. Looking for demo files? In JavaReviewContinued in the Code
Library in Canvas, see ArrayDemo7.java, PayrollScannerIssue.java, and RectangleArrayDemo.java. For
one of the extra credit items see and SoccerTeams.java.
Feel free to use this line of code for displaying the column header and to use it as the template for
displaying the data
System.out.printf(“\n%-30s %-30s %3s\n”,”Song Title”,”Artist”,”Len”);
Don’t forget to handle the Scanner issue — eat the carriage return after the nextInt( ) using:
input.nextLine();
Sample Run:
Enter song title (xxx to stop) for song 0: Laila
Enter artist for song 0: Eric Clapton
Enter length in seconds for song 0: 399
Enter song title (xxx to stop) for song 1: I’m Like a Bird
Enter artist for song 1: Nelly Furtado
Enter length in seconds for song 1: 165
Enter song title (xxx to stop) for song 2: There You’ll Be
Enter artist for song 2: Faith Hill
Enter length in seconds for song 2: 215
Enter song title (xxx to stop) for song 3: Eat it
Enter artist for song 3: Wierd Al Yankovic
Enter length in seconds for song 3: 209
Enter song title (xxx to stop) for song 4: xxx
Song Title
Artist
Laila
Eric Clapton
I’m Like a Bird
Nelly Furtado
There You’ll Be
Faith Hill
Eat it
Wierd Al Yankovic
Sample Run showing when no songs entered
Enter song title (xxx to stop) for song 0: xxx
1
Len
399
165
215
209
CSIT 254 Programming Lab 2 – Java Review
No songs entered
Grading Rubric
• Comment in program with name (2 points)
• Declaring and instantiating an array of Song (10 points)
o For this lab you must use an array, not ArrayList
o Note: the rest of the program should use arrayName.length
• Prompt the user for Song Title (10 points)
o and show the index that will be used (2 points)
o Note: if you write your loop like the loop in ArrayDemo7.java then the prompt will be in
two places
• Sentinel controlled loop to get input from user where Song Title is used for the sentinel (10
points)
• Inside the loop
o prompt the user for the artist (10 points)
▪ and show the index that will be used (2 points)
o prompt the user for the length of the song (10 points)
▪ and show the index that will be used (2 points)
▪ For this lab you can assume the user will enter an integer
▪ For extra credit prevent the user from entering a length < 1 (see below) o instantiation a Song object using values from user at the next available element (10 points) o advancing the ‘index’ (4 points) • After the loop o if the user had entered no songs display that no songs were entered (5 points) o Otherwise, displaying values from each object using getters (10 points) • following the naming guidelines for Classes and identifiers (8 points) • proper indenting (5 points) • -3 points if program does not compile and -1 point for each syntax error Submitting the lab Attach the .zip file of the NetBeans project to the “Pgmg Lab2” Assignment in Canvas 2 CSIT 254 Programming Lab 2 – Java Review Extra Credit Options • • Don’t let the user enter a length < 1 (10 points) Don’t let the user overfill the array and let them know when the array is full (10 points) Extra Credit - Sample Run showing error handling for lengths < 1 Enter song title (xxx to stop) for song 0: Grunt Enter artist for song 0: Captain Caveman Enter length in seconds for song 0: -1 length must be at least 1 second Enter length in seconds for song 0: 0 length must be at least 1 second Enter length in seconds for song 0: 1 Enter song title (xxx to stop) for song 1: xxx Song Title Grunt Artist Captain Caveman Len 1 Using 2 for size of array for this demo Song[] mySongList = new Song[2]; Extra Credit - Sample Run using an array of length 2 Enter song title (xxx to stop) for song 0: Mambo No. 5 Enter artist for song 0: Lou Bega Enter length in seconds for song 0: 225 Enter song title (xxx to stop) for song 1: Bohemian Rhapsody Enter artist for song 1: Queen Enter length in seconds for song 1: 355 Array full Song Title Mambo No. 5 Bohemian Rhapsody Artist Lou Bega Queen 3 Len 225 355

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER