Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone help me stop my loop when the user types in quit. JAVA public static ArrayList songRequest() { ArrayList songs = new ArrayList ();
Can someone help me stop my loop when the user types in quit. JAVA
public static ArrayList
ArrayList
Scanner scan = new Scanner(System.in);
System.out.println("Enter songs you would like to request (quit when done): ");
String songChoice = scan.nextLine();
// looping until user enter quit
while (!songChoice.equalsIgnoreCase("quit")) {
// adding to playlist
songs.add(songChoice);
// reading next song name
songChoice = scan.nextLine();
}
return songRequest();
}
Step 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