Question: The program is supposed to prompt the user to enter several integers, store them into an array, then print those integers back out in forwards
The program is supposed to prompt the user to enter several integers, store them into an array, then print those integers back out in forwards and backwards order. Finish the program so that it runs properly. Make your program flexible enough that it will work no matter how many integers the user wants to type.
How many numbers will you enter? 4 Type a number: 12 Type a number: 8 Type a number: -2 Type a number: 39 Your numbers in forward order: 12 8 -2 39 Your numbers in backward order: 39 -2 8 12
public class PromptNumbers { public static void main(String[] args) { Scanner console = new Scanner(System.in); System.out.print("How many numbers will you enter? "); int count = console.nextInt(); for (int i = ???; i < ???; i++) { // your code goes here; store the numbers System.out.print("Type a number: "); } System.out.println(); System.out.println("Your numbers in forward order:"); for (int i = ???; i < ???; i++) { // your code goes here; print the numbers in forward order }
System.out.println(); System.out.println("Your numbers in backward order:"); // your code goes here; print the numbers in forward order } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
