Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java How would I make it so it just prints out all the pools once the user stops imputing information import java.util.*; class InputWithArrayList {
Java How would I make it so it just prints out all the pools once the user stops imputing information import java.util.*; class InputWithArrayList { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayListpool = new ArrayList (); int count = 1; int j = 1; System.out.print("Enter Width : "); String width = sc.nextLine(); System.out.print("Enter Depth : "); String depth = sc.nextLine(); System.out.print("Enter Shape : "); String shape = sc.nextLine(); int w = Integer.parseInt(width); int d = Integer.parseInt(depth); while (true) { if (w == -1 || d == -1) break; // print the data here System.out.println("The pool is "+width+" wide and "+depth+" deep and as order its a "+shape); pool.add(width); pool.add(depth); pool.add(shape); System.out.print("Enter Width : "); width = sc.nextLine(); w = Integer.parseInt(width); if (w == -1) break; System.out.print("Enter Depth : "); depth = sc.nextLine(); d = Integer.parseInt(depth); if (d == -1) break; System.out.print("Enter Shape : "); shape = sc.nextLine(); } } }
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