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
dexar [7]
3 years ago
9

14) Modify the method that calculates the sum of the integers between 1 and N. Have the new version match the following recursiv

e definition: The sum of 1 to N is the sum of 1 to (N/2) plus the sum of (N/2 1) to N. Trace your solution using an N of 7.
Physics
1 answer:
Setler [38]3 years ago
8 0

Explanation:

Let solve the program using Java programming language

Method: method means group of statements to perform some operation.

             let call the method sum.

Parameters: list of variables that are use in the method for declaration.

<u>The code</u>

public int sum (int number)

int answer;

if (number == 1)

answer = number;

else

{

int half = number/2;

int span = number - half;

answer = sum(half) + sum(span) + (half * span);

}

answer result;

}

Firstly we defined the method called sum(), the method takes only one parameter which is number and return the answer(sum of  the integers 1 and N).

if the number is equal to 1, so it will return the number and if the number is not equal to 1 it will divide the number by 2 and get the span(span used to shift upper range).And result will add sum of half, sum of span and product of half span.

You might be interested in
What is common to all fossil fuels?
natta225 [31]
All fossil fuels are formed deep underground. they are all nonrenewable energy
3 0
3 years ago
Read 2 more answers
Find your acceleration from 8.3 m/s to 12.5 m/s in 1.24 seconds.
balu736 [363]

The <u>average</u> acceleration for an object undergoing this change in velocity is

(12.5 m/s - 8.3 m/s) / (1.24 s) = (4.2 m/s) / (1.24 s) ≈ 3.4 m/s²

4 0
2 years ago
if you push your chair across the floor at a constant velocity how does the force of friction compare with the force you exert?
Alik [6]
-- If velocity is constant, then there is no net force
on the chair.

-- If there is no net force on the chair, then friction
must exactly balance out your push.

-- The force of friction is exactly equal in magnitude
to your push, and in exactly the opposite direction.
5 0
3 years ago
Read 2 more answers
You're driving down the highway late one night at 20 m/s when a deer steps onto the road 38 m in front of you. Your reaction tim
Bingel [31]

Answer:

given,

speed of the car = 20 m/s

final speed of car = 0 m/s

distance between car and the deer = 38 m

reaction time, t = 0.5 s

deceleration of the car = 10 m/s².

a) distance between deer and car

  distance travel in the reaction time

   d₁ = v x t

   d₁ = 20 x 0.5 = 10 m

   distance travel after you apply brake

   using equation of motion

   v² = u² + 2 a s

   0 = 20² - 2 x 10 x s

    s =  20 m

total distance traveled by the car

D = d₁ + d₂

D = 20 + 10 = 30 m

  distance between car and the deer = 38 m - 30 m

                                                              = 8 m

b) now, maximum speed car.

   distance travel in reaction time

    d₁ = s x t

    d₁ = 0.5 V

distance left between them

   d₂ = 38 - d₁

   d₂ = 38 - 0.5 V

   distance travel after you apply brake

   using equation of motion

    v² = u² + 2 a d₂

    0 = (V)² - 2 x 10 x (38 - 0.5 V)

     V² + 10 V - 760 = 0

now, solving the quadratic equation

  x = \dfrac{-b\pm \sqrt{b^2-4ac}}{2a}

  V = \dfrac{-10\pm \sqrt{10^2-4(1)(-760)}}{2(1)}

         V = 23.01 , -33.01

rejecting the negative term.

hence, maximum speed of the car could be V = 23.01 m/s

 

7 0
3 years ago
Predict using Boyle's law, what will happen to a balloon that an ocean diver takes to a pressure of 202 kPa.
kobusy [5.1K]

The volume of the balloon will halve

Explanation:

Boyle's law states that for an ideal gas kept at constant temperature, the pressure of the gas is proportional to its volume. Mathematically,

pV=const.

where

p is the gas pressure

V is the volume

The equation can also be rewritten as

p_1 V_1 = p_2 V_2

And if we apply it to the gas inside the balloon in this problem (assuming its temperature is constant), we have:

p_1 = 101 kPa is the initial pressure at sea level (the atmospheric pressure)

V_1 is the initial volume

p_2 = 202 kPa is the final pressure

V_2 is the final volume

Substituting into the equation, we find:

V_2 = \frac{p_1 V_1}{p_2}=\frac{(101)V_1}{202}=\frac{V_1}{2}

Which means that the volume of the balloon will halve.

Learn more about ideal gases:

brainly.com/question/9321544

brainly.com/question/7316997

brainly.com/question/3658563

#LearnwithBrainly

6 0
4 years ago
Other questions:
  • For each type of wave compare the vibration of the medium to the direction of the wave
    14·1 answer
  • An airplane is traveling 25° west of north at 300 m/s when a wind with velocity 100 m/s directed 35° east of north begins to blo
    15·1 answer
  • B. a student attaches a nozzle with an exit radius that is n times smaller than the faucet radius. 2b) let n = 3 i. how will thi
    10·1 answer
  • Point X is midway between the charges. In what section of the line will there be a point where the resultant electric field is z
    9·1 answer
  • A ball is thrown at 23.2 m/s inside a boxcar moving along the tracks at 34.9 m/s. What is the speed of the ball relative to the
    11·1 answer
  • N=-D(n2-n1)/(x2-x1) D is diffastion.What are the dimensions of D.
    7·1 answer
  • ______ is the most abundant gas in Earth’s atmosphere.
    14·1 answer
  • French jrnf;kwnb;vnkj2wert
    13·1 answer
  • Calculate the average (mean) of these numbers: 6, 5, 7, 9.8*
    15·1 answer
  • Please help me with this I need a 10 sentence for it please open the image
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!