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
Geologists know the past temperature of the planet based on rock and fossil evidence. Why do you think it is difficult to determ
Basile [38]

Answer:

I think it is difficult to determine what has caused climate change in the distant past because it must have been a long time ago so geologists can't carry out different experiments and figure out what gases the planet had conjured, so geologists can only make predictions based off the evidence they currently have from what the planet looked like before. The planet must have changed over the years, therefore the climate has also changed in the future, so they cannot work with how the planet looked in the past.

7 0
3 years ago
An object of mass 3.00 kg, moving with an initial velocity of 5.05 m/s, collides with and sticks to an object of mass 2.76 kg wi
Lynna [10]

Answer:

0.752 m/s

Explanation:

m1 = 3.00kg

u1 = 5.05m/s

m2 = 2.76kg

u2 = -3.66m/s

According to the law of conservation of momentum,

m1u1 + m2u2 = (m1+m2)v

3(5.05) + 2.76(-3.66) = (5.05+2.76)v

15.15 - 9.2736 = 7.81v

5.8764 = 7.81v

v = 5.8764/7.81

v = 0.752m/s

6 0
3 years ago
Suppose you first walk 12.0 m in a direction 20? west of north and then 20.0 m in a direction 40.0? south of west. how far are y
Gnesinka [82]
The representation of this problem is shown in Figure 1. So our goal is to find the vector \overrightarrow{R}. From the figure we know that:

\left | \overrightarrow{A} \right |=12m \\ \\ \left | \overrightarrow{B} \right |=20m \\ \\ \theta_{A}=20^{\circ} \\ \\ \theta_{B}=40^{\circ}

From geometry, we know that:

\overrightarrow{R}=\overrightarrow{A}+\overrightarrow{B}

Then using vector decomposition into components:

For \ A: \\ \\ A_x=-\left | \overrightarrow{A} \right |sin\theta_A=-12sin(20^{\circ})=-4.10 \\ \\ A_y=\left | \overrightarrow{A} \right |cos\theta_A=12cos(20^{\circ})=11.27 \\ \\ \\ For \ B: \\ \\ B_x=-\left | \overrightarrow{B} \right |cos\theta_B=-20cos(40^{\circ})=-15.32 \\ \\ B_y=-\left | \overrightarrow{B} \right |sin\theta_B=-20sin(40^{\circ})=-12.85

Therefore:

R_x=A_x+B_x=-4.10-15.32=-19.42m \\ \\ R_y=A_y+B_y=11.27-12.85=-1.58m

So if you want to find out <span>how far are you from your starting point you need to know the magnitude of the vector \overrightarrow{R}, that is:
</span>
\left | \overrightarrow{R} \right |=&#10;\sqrt{R_x^2+R_y^2}=\sqrt{(-19.42)^2+(-1.58)^2}=\boxed{19.48m}

Finally, let's find the <span>compass direction of a line connecting your starting point to your final position. What we are looking for here is an angle that is shown in Figure 2 which is an angle defined with respect to the positive x-axis. Therefore:

</span>\theta_R=180^{\circ}+tan^{-1}(\frac{\left | R_y \right |}{\left | R_x \right |}) \\ \\ \theta_R=180^{\circ}+tan^{-1}(\frac{1.58}{19.42}) \\ \\ \theta_R=180^{\circ}+4.65^{\circ}=185.85^{\circ}


6 0
3 years ago
What is the name of the force that is a combination of all forces that act on an object?
jarptica [38.1K]

Answer:

If the combination of all the forces acting on an object sums upto be zero, then the net force is known as <u>balanced force.</u>

If the combination of all the forces acting on an object is non-zero, then the net force is said to be <u>unbalanced force. </u>The unbalanced force causes the object change the state of rest or motion.

6 0
3 years ago
An isolated charged point particle produces an electric field with magnitude E at a point 2 m away. At a point 1 m from the part
guajiro [1.7K]

Explanation:

The electric field at a distance r from the charged particle is given by :

E=\dfrac{kq}{r^2}

k is electrostatic constant

if r = 2 m, electric field is given by :

E_1=\dfrac{kq}{(2)^2}\\\\=\dfrac{kq}{4}\ .....(1)

If r = 1 m, electric field is given by :

E_2=\dfrac{kq}{r_2^2}\\\\=\dfrac{kq}{1}\ ....(2)

Dividing equation (1) and (2) we get :

\dfrac{E_1}{E_2}=\dfrac{\dfrac{kq}{4}}{kq}\\\\\dfrac{E_1}{E_2}=\dfrac{1}{4}\\\\E_2=4\times E_1

So, at a point 1 m from the particle, the electric field is 4 times of the electric field at a point 2 m.

4 0
2 years ago
Other questions:
  • A 65kg person throw a 0.045kg snowball forward with a ground speed of 30m/s. A second person, with a mass of 60kg, catches the s
    5·1 answer
  • . List five endothermic reactions that are going on around you.
    13·1 answer
  • Light of wavelength 610 nm falls on a slit that is 3.50×10^−3 mm wide. How far the first bright diffraction fringe is from the s
    11·1 answer
  • 17,874,000 what is the value of 1
    13·2 answers
  • Jake is bowling with an 8 kg bowling ball roll the ball at 7 Ms and it hits 1 stationary pain with a mass of 2kg the pain goes f
    8·1 answer
  • 2. True or false?<br> Forensic entomology uses the study of insects to help criminal investigations.
    12·2 answers
  • 1 A 75-g ball is projected from a height of 1.6 m with a horizontal velocity of 2 m/s and bounces from a 400-g smooth plate supp
    14·1 answer
  • Which of the following are places that you can work out
    9·2 answers
  • Why do ice cubes float to the top of a glass of water?
    8·2 answers
  • liquid helium has a very low boiling point, 4.2 k, as well as a very low latent heat of vaporization, 2.00 104 j/kg. if energy i
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!