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();
}
}
Answers: 2
Computers and Technology, 22.06.2019 11:00
How does a policy manual an organization? a. it boost productivity. b. it create awareness in employees about the organization’s values. c. it employees achieve targets. d. it safeguards the organization from liabilities.
Answers: 1
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
I'm having issues of running this code, can anyone help? Here's the instructions:
Write an applicat...
Chemistry, 29.07.2021 01:10
Biology, 29.07.2021 01:10
Social Studies, 29.07.2021 01:10
Physics, 29.07.2021 01:10
Biology, 29.07.2021 01:10