Question: Question: Modify the program from PP 8.1 so that it works for numbers in the range between -25 and 25. Please use this program format

Question: Modify the program from PP 8.1 so that it works for numbers in the range between -25 and 25.

Please use this program format and modify it so it will work for numbers between -25 and 25:

import java.util.Scanner;

public class CountUserInput {

public static void main(String[] args) { int[] count = new int[51]; //between 0 and 50 inclusive System.out.println("Please enter an integers between 0 and 50, " + "Enter an out of range number to end: "); Scanner scan = new Scanner(System.in); int input = scan.nextInt(); while (input >= 0 && input <= 50){ count[input]++; input = scan.nextInt(); } System.out.println("Number" + "\tCount"); for(int i=0; i0) System.out.println(i + "\t" + count[i]); } }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!