1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lyudmila [28]
3 years ago
10

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 pentagonal numbers with 10 numbers on each line, one space between each number, and the user entering the integer value for n.
Computers and Technology
1 answer:
Igoryamba3 years ago
7 0

Answer:

Check the explanation

Explanation:

public class Exercise_06_01 {

/** Main Method */

public static void main(String[] args) {

 final int NUMBER_OF_PENTAGONALS = 100; // Display the first 100 pentagonals

 final int NUMBER_PER_LINE = 10; // Display 10 number per line

 // Display the first 100 pentagol numbers

 System.out.println("The first 100 pentagonal numbers, ten per line: ");

 for (int i = 1; i <= NUMBER_OF_PENTAGONALS; i++) {

  // Print ten numbers per line

  if (i % NUMBER_PER_LINE == 0)  

   System.out.printf("%7d\n", getPentagonalNumber(i));

  else

   System.out.printf("%7d", getPentagonalNumber(i));

 }

}

/** Return a pentagonal number */

public static int getPentagonalNumber(int n) {

 return (n * (3 * n - 1)) / 2;

}

}

You might be interested in
In object-oriented development, why is it necessary to use drivers and stubs in testing?
HACTEHA [7]

Answer: In object-oriented approach for the development of operating system requires stub and driver as essential part for the creation of proper interaction of the object oriented components with the external system.They help in testing of the module.

Stub is the unit that acts as a piece of code which fills in the place of the missing section in the system. The functions of the system module is tested by stub .

Driver is the part that helps in citing the system modules under the testing conditions.It is the piece of code that creates the calling function simulation.

5 0
4 years ago
Why is it important to use a structured cabling standard when installing and managing cabling systems?
Bumek [7]

Answer:

Because it is a industry standard and it describes the best way to install networking media to maximize performance and minimize upkeep.

Explanation:

Structured cabling consists of best-practices involving the design and construction of your telecommunication infrastructure. These practices help standardize your telecom cabling structure to facilitate interoperability, moves and additions, and system dependability.Even though cables and wires are generally hidden behind walls, structured cabling solutions provide much needed benefits to businesses and data centers. Without it, the system is put at risk, especially during maintenance.

8 0
3 years ago
Janet has created a 3D movie. She wants to make a copy of the movie and store it for future use. Which device should she use?
Valentin [98]

She can use secondary storage devices like:

1) Hard Disk

2) Floppy disks

3) Pen-Drives

3 0
3 years ago
Drag each tile to the correct box. (No links please)
Sergio039 [100]

Answer:

For Rachael to pursue a career in business information management. She is expected to follow the following route one after the other.

1. Training in management skills and data storage

2. Certification in MIS

3. Bachelor's degree in business administration

4. Master's degree in business administration

Hope this helped! ;)

5 0
3 years ago
Read 2 more answers
When opening a file in Windows, the creation of ____ helps bridge the gap between the characteristics of physical devices and di
ololo11 [35]

Answer:

an electronic computer folder

4 0
4 years ago
Other questions:
  • Need help with these
    5·1 answer
  • if an open cut or wound is exposed to contamination washing it in hot water and hand soap is not sufficient to keep safe
    14·2 answers
  • Rob used Track Changes to suggest changes in Jack's document. Jack agrees with some edits and disagrees with others. What should
    14·1 answer
  • Describe the following types of Cloud services:
    11·1 answer
  • Which are examples of ribbon customizations?
    11·1 answer
  • Choose the best function for the purpose.
    11·1 answer
  • Computer identity theft differs from theft in the real world in what major way?
    11·2 answers
  • Add the following numbers in abacus 2436+9214​
    8·1 answer
  • 4. When working at the CLI in Linux, you specify the exact location of a file, which is the ____________________ to it, by begin
    13·1 answer
  • Who is the monst important person and why
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!