![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 30.09.2020 05:01 narnia85
I'm having issues of running this code, can anyone help? Here's the instructions:
Write an application that instantiates five Recording objects and prompts the user for values for the data fields. Then prompt the user to enter which field the Recordings should be sorted by—song title, artist, or playing time. Perform the requested sort procedure, and display the Recording objects. Save the file as RecordingSort. java.
Here's the code that I'm working on:
import java. util. Scanner;
public class RecordingSort {
public static void main(String[] args) {
// initializes array for Recording objects
Recording[] list = new NRecording[5];
Scanner input = new Scanner(System. in);
int i = 0;
// prompts user for song title, artist, and playing time.
// takes information and stores it within object
for (i = 0; i 0 && sortMethod 0) {
// reorders the songs if necessary
Recording temp = list[b];
list[b] = list[c];
list[c] = temp;
}
}
// sorts by artist
else if (sortMethod == 2) {
// compares name of one artist with the name of the artist immediately after it
if (list[b].getArtist().compareTo(list [c].getArtist()) > 0) {
// reorders the songs if necessary
Recording temp = list[b];
list[b] = list[c];
list[c] = temp;
}
}
// sort by playing time
else if (sortMethod == 3) {
// compares one song's playing time with playing time of the song immediately after it
if (list[b].getPlayingTime() > list[c].getPlayingTime()) {
// reorders the songs if necessary
Recording temp = list[b];
list[b] = list[c];
list[c] = temp;
}
}
}
}
}
else {
System. out. println("Invalid choice. Please choose 1, 2, or 3.");
}
} while (sortMethod 3); // continues loop if user chooses invalid number
// adds line space
System. out. println();
// displays songs in whatever order was chosen
for (i = 0; i < list. length; i++) {
System. out. println("Song: Title: " + list[i].getTitle() + ". Artist: " + list[i].getArtist() + ". Playing time: "
+ list[i].getPlayingTime() + " seconds.");
}
// closes scanner
input. close();
}
}
![ansver](/tpl/images/cats/User.png)
Answers: 2
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 03:20
Which of these is a benefit of social networking? oa. hiding your true identity from friendsob. avoiding talking to people in personoc. spending time with friends instead of studyingod. connecting with new people
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 22:00
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 06:40
How many nibbles can be stored in a 16-bit word?
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
You know the right answer?
I'm having issues of running this code, can anyone help? Here's the instructions:
Write an applicat...
Questions
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/ekonomika.png)
Business, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/es.png)
Spanish, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/himiya.png)
Chemistry, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01
![question](/tpl/images/cats/mat.png)
Mathematics, 09.09.2020 05:01