Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

2Al(s) + Cr2O72(aq) + 14H+(aq) 2Al3+(aq) + 2Cr3+(aq) + 7H2O(l)

Answered: 1 week ago

Question

Which version of Ethernet was introduced in 1 9 9 0 ?

Answered: 1 week ago

Question

=+6 Who is the peer of the IA ?

Answered: 1 week ago

Question

=+herself to in terms of equity with regard to this assignment?

Answered: 1 week ago

Question

=+ What typical employee will the IA compare him/

Answered: 1 week ago