Answered step by step
Verified Expert Solution
Link Copied!

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 songRequest() {

ArrayList songs = new 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago