Question
Create a new Java class called: NumberGrid Write a program that will get two integers from the user. The program should then print, to the
Create a new Java class called: NumberGrid
Write a program that will get two integers from the user. The program should then print, to the screen, all of the numbers from 1000 to 2000 (including 1000 and 2000) which divides evenly by the two integers entered by the user.
The program should not print more than 10 numbers per line.
The following is an example of what your MIGHT see on the screen when your program runs. The exact output depends on what values that the user types in while the program runs. Please be sure that you test ALL of the examples shown below with your program. The user's inputted values are shown below in italics:
Enter two numbers: 5 6 The numbers from 1000-2000 which are divisible by 5 and 6 are: 1020 1050 1080 1110 1140 1170 1200 1230 1260 1290 1320 1350 1380 1410 1440 1470 1500 1530 1560 1590 1620 1650 1680 1710 1740 1770 1800 1830 1860 1890 1920 1950 1980
Here is another example program run:
Enter two numbers: 12 14 The numbers from 1000-2000 which are divisible by 12 and 14 are: 1008 1092 1176 1260 1344 1428 1512 1596 1680 1764 1848 1932
Technical Notes & Hints:
Use a counter-controlled loop (a FOR loop would be best) to count through all numbers from 1000 to 2000 to test each one to see if it should be printed to the screen.
Use a second counter (but NOT a second loop) to determine when 10 numbers have been printed. Each time a number is printed to the screen, increase this second counter. When this counter reaches 10, print a line break (to end the line), and then reset the counter to 0.
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