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
Dima020 [189]
3 years ago
15

Write a method named hopscotch that accepts an integer parameter for a number of "hops" and prints a hopscotch board of that man

y hops. A "hop" is defined as the split into two numbers and then back together again into one. For example, hopscotch(3); should print ________.
Computers and Technology
1 answer:
Ivanshal [37]3 years ago
8 0

Answer:

Following are the program in the Java Programming Language.

public class Main // declared class  

{

public void hopscotch(int x) // function definition  

{

int count=0; // variable declaration  

for (int j=0; j<x; j++) // iterating over the loop

{

System.out.println(" " + (++count)); // print the value of count

System.out.println((++count) + " " + (++count));

}

System.out.println(" " + (++count));  

}

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

{

Main ob=new Main(); // creating object

ob.hopscotch(3); // calling hopscotch method  

}

}

<u>Output</u>:

  1

2     3

  4

5     6

  7

8     9

  10

Explanation:

Here, we define a class "Main" and inside the class, we define a function  "hopscotch()" and pass an integer type argument in its parentheses and inside the function.

  • We set an integer variable "count" and assign value to 0.
  • Set the for loop which starts from 0 and end at "x" then, print space and value inside the loop, again print value then space then value, then repeat the 1st print space then value.
  • Finally, set the main function "main()" and inside the main function, we create the object of the class "ob" then, call the function " hopscotch()" through the object and pass the value 3 in its parentheses.
You might be interested in
A method in a class that modifies information about an object is called a/an ____ method.
exis [7]
<span>A method in a class that modifies information about an object is called a <u>mutator</u> method.</span>
7 0
3 years ago
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
sammy [17]

In python:

age = float(input("How old are you? "))

weight = float(input("How much do you weigh? "))

heart_rate = float(input("What's your heart rate? "))

time = float(input("What's the time? "))

print("The calories burned for men is {}, and the calories burned for women is {}.".format(

   ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),

   ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))

This is the program.

When you enter 49 155 148 60, the output is:

The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.

Round to whatever you desire.

6 0
3 years ago
A keyboard, mouse, and microphone are examples of ________.
kykrilka [37]

Answer:

A keyboard, mouse, and microphone all are examples of <u>peripheral devices.</u>

Explanation:

hope this helps

5 0
2 years ago
Read 2 more answers
With a ____ indent, all lines except the first line of the paragraph are indented from the left margin.
hoa [83]

The answer to this question is a hanging indent. A hanging indent is a writing format where in the first line of the text or paragraph is being aligned in the left margin. A hanging indent is also known as the hanging paragraph.  

3 0
3 years ago
You receive an email from someone who claims to be a representative from your credit card company. the email asks you to clink o
larisa86 [58]
You should call the company that your credit card is in and ask if you were sent an email. tell the time it was sent. the date. everything.
8 0
3 years ago
Other questions:
  • A job application is a form used to make a job request.<br> True<br> False
    8·2 answers
  • There are many careers within the IT industry. _____ are responsible for organizing a company's data, making sure all the data i
    9·1 answer
  • Which element of a business document provides additional information but is not a part of the body of the text?
    13·2 answers
  • Which of the following is a goal of paraphrasing​
    12·1 answer
  • ________is a Windows software program with powerful accessibility solution that reads information on your screen using synthesiz
    9·1 answer
  • What is this line of code doing? scanf("%f", &amp;height);
    6·1 answer
  • Where can you find your EFC
    8·2 answers
  • Which one is correct
    8·1 answer
  • _____ include the people, procedures, hardware, software, data, and knowledge needed to develop computer systems and machines th
    11·1 answer
  • Complete the statement using the correct term.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!