Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Why am I getting an assertion error in my code saying that the reason is an incorrect string interpolation.this is my code: I am getting

Why am I getting an assertion error in my code saying that the reason is an incorrect string interpolation.this is my code: I am getting the correct output code for my code,but I am getting an assertion error message say incorrect output message which is the result of incorrect string interpolation. why is this? This is my code so far: import java.util.*; public class DebugNine3 { public static void main(String[] args) { ArrayList products = new ArrayList(); products.add("shampoo"); products.add("moisturizer"); products.add("conditioner"); Collections.sort(products); display(products); final String QUIT = "quit"; String entry; Scanner input = new Scanner(System.in); System.out.print(" Enter a product or + QUIT + to quit >> "); entry = input.nextLine(); while(!entry.equals("quit")) { products.add(entry); Collections.sort(products); display(products); System.out.print(" Enter a product or " + QUIT + " to quit >> "); entry = input.nextLine(); } } public static void display(ArrayListproducts) { System.out.println(" The size of the list is " + products.size()); for(int x = 0; x

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions