Question: 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); ArrayList pool = 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
