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
A personal computer system is composed of the processing unit, graphics board, and keyboard with reliabilities of 0.976, 0.785,
frosja888 [35]

Answer:

The answer to the following question is the option "B".

Explanation:

In computer science, the term Reliability is an attribute for any computer-related element like software or hardware. It consistently acts according to its terms. It has a lengthy process for considering one of three similar properties that must be analyzed when using a computer component. So the answer to this question is option B which is "0.684".

7 0
3 years ago
DDL statement for adding a column to an existing table is
vaieri [72.5K]

Answer:to add a column to existing table.

to rename any existing column.

to change datatype of any column or to modify its size.

to drop a column from the table.

Explanation:

hope this help

4 0
2 years ago
Which method call converts the value in variable stringVariable to an integer?
zlopas [31]

Answer:

The correct answer for the given question is Integer.parseInt( string variable );

Explanation:

Integer.parseInt( string variable ); is the method in a java programming language that convert the string into the integer value. It takes a string variable and converted into the integer.

Following are the program in java which convert the string value into an integer value.

class Main  

{

 public static void main(String []args) // main function

{

   String str1 = "10009";

// variable declaration

   int k = Integer.parseInt(str1);

// convert the string into integer.

   System.out.println("Converted into Int:" + k);

}

}

Output:

Converted into Int:10009

Convert.toInt( stringVariable );

Convert.parseInt( stringVariable,Integer.toInt( stringVariable ); are not any method to convert the string into integer .

Therefore the correct answer is :Integer.parseInt( stringVariable );

3 0
3 years ago
Sandra has composed a draft of her essay in Microsoft Word. She now wants to revise the essay. Which tool can she use to store t
d1i1m1o1n [39]

Answer:

she can use Ctrl S then open it again

Explanation:

i hope this helps and please mark as brainliest

4 0
3 years ago
Okay this isnt kinda a real question but what is up with answers
mixas84 [53]

Answer:

i know right

Explanation:

8 0
3 years ago
Other questions:
  • A(n) _____ is a type of man-in-the-middle attack where an attacker captures the data that is being transmitted, records it, and
    15·2 answers
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • Write a function getPigLatin(pigStr) that accepts pigStr as a parameter (a sentence as input) and converts each word to "Pig Lat
    8·1 answer
  • You can run a macro by:
    10·1 answer
  • Brian drives a car that uses voice commands for navigation. Which field did researchers use to develop a car-based AI that under
    10·1 answer
  • Instructions:Select the correct answer from each drop-down menu.
    14·1 answer
  • A or an is a simple chip with two or more processor core
    5·1 answer
  • You have a host device with an assigned IP address of 192.168.15.100 and a subnet mask of 255.255.255.192. To what network does
    13·1 answer
  • Many subject elements make for simple and streamlined looking images. true or false
    7·1 answer
  • Which of the following best describes the impact of Creative Commons?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!