subject
Computers and Technology, 16.10.2020 06:01 1129682

1 // Application contains a starting list of three products for sale2 // The user is prompted for additional items3 // After each new entry, the alphabetically sorted list is displayed4 import java. util.*;5 public class DebugNine36 {7 public static void main(String[] args)8 {9 ArrayListproducts = new ArrayList();10 products. add(shampoo);11 products. add(moisturizer);12 products. add(conditioner);13 Collections. sort(products);14 display(products);15 final String QUIT = "quit";16 String entry;17 Scanner input = new Scanner(System. in);18 System. out. print("\nEnter a product or " + QUIT + " to quit >> ");19 entry = input. nextLine();20 while(entry. equals("quit"))21 {22 products. add(entry);23 Collections. sort(products);24 display()25 System. out. print("\nEnter a product or " + QUIT + " to quit >> ");26 entry = input. nextLine();27 }28 public static void display(ArrayList products)29 {30 System. out. println("\nThe size of the list is " + products. size());31 for(int x = 0; x == products. size(); ++x)32 System. out. println(products. get(x));33 }34 }35//Debugging Exercises, Chapter 9;Java Programming, Joyce Farraell, 8th

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:30, juliannxkim
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
image
Computers and Technology, 23.06.2019 02:30, jaueuxsn
Which component acts as a platform on which application software runs
Answers: 2
image
Computers and Technology, 23.06.2019 02:30, chaaaa
People with high self-esteem: accept their strengths and weaknesses. believe that failed experiences are failures of their whole self. feel good about who they are only when they reach total success. need positive external experiences to counteract negative feelings that constantly plague them.
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, darlene93
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
You know the right answer?
1 // Application contains a starting list of three products for sale2 // The user is prompted for ad...

Questions in other subjects: