(Math: pentagonal numbers) java

6-1) (Math: pentagonal numbers) A pentagonal number is defined as n(3n–1)/2 for n = 1, 2, . . ., and so on. Therefore, the first few numbers are 1, 5, 12, 22, . . . . Write a method  with the following header that returns a pentagonal number:public static int  getPentagonalNumber(int  n)Write a test program  that uses this method  to display the first n pentagonalnumbers with 10 numbers on each line, one space between  each number, and the user entering the integer value  for n.— Prompts For Keyboard/Console/Standard Input —Enter an integer  for the n pentagonal numbers you want displayed:— Keyboard/Console/Standard Input stdin —20 — Monitor/Console/Standard Output  —Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 (Note: this combines standard input with standard output )>java PentagonalNumbers Enter an integer  for the n pentagonal numbers you want displayed: 20 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 — Prompts For Keyboard/Console/Standard Input —Enter an integer  for the n pentagonal numbers you want displayed:— Keyboard/Console/Standard Input stdin —33 — Monitor/Console/Standard Output  —Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 (Note: this combines standard input with standard output )>java PentagonalNumbers Enter an integer  for the n pentagonal numbers you want displayed: 33 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 — Prompts For Keyboard/Console/Standard Input —Enter an integer  for the n pentagonal numbers you want displayed:— Keyboard/Console/Standard Input stdin —67 — Monitor/Console/Standard Output  —Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 2882 3015 3151 3290 3432 3577 3725 3876 4030 4187 4347 4510 4676 4845 5017 5192 5370 5551 5735 5922 6112 6305 6501 6700 (Note: this combines standard input with standard output )>java PentagonalNumbers Enter an integer  for the n pentagonal numbers you want displayed: 67 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 2882 3015 3151 3290 3432 3577 3725 3876 4030 4187 4347 4510 4676 4845 5017 5192 5370 5551 5735 5922 6112 6305 6501 6700 — Prompts For Keyboard/Console/Standard Input —Enter an integer  for the n pentagonal numbers you want displayed:— Keyboard/Console/Standard Input stdin —43 — Monitor/Console/Standard Output  —Enter an integer  for the n pentagonal numbers you want displayed:1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 (Note: this combines standard input with standard output )>java PentagonalNumbers Enter an integer  for the n pentagonal numbers you want displayed: 43 1 5 12 22 35 51 70 92 117 145 176 210 247 287 330 376 425 477 532 590 651 715 782 852 925 1001 1080 1162 1247 1335 1426 1520 1617 1717 1820 1926 2035 2147 2262 2380 2501 2625 2752 compile w NetBeans

Looking for this or a Similar Assignment? Click below to Place your Order

Open chat