A programmer wants to write a procedure that calculates the net elevation - total number of feet a traveler goes up and down. For example, looking at the first 3 segments of travel, the net elevation is 7 feet (up 3, up 1, down 3). Write procedure (in either JavaScript or pseudocode) called processPath(data) that: Accepts a list of elevation data as a parameter For every value in the list Compute the absolute difference between that value and the value next to it on the path Add the difference to a running total Return the total elevation traveled

Respuesta :

Answer:

Pseudocode

////////////////////////////////////////////////////////////////////////////////////////////////////////////

Integer netElevation(list of elements of type elevation - type and number)

function open

   Define running total = 0

   for each element from list

   loop open

       elevation type = element[i].type

      if (elevation type == Up)

           running total = running total + element[i].number

       else

           running total = running total - element[i].number

   loop close

   return running total

function close

In this exercise, using the knowledge of computational language in psudocode, we have that this code will be written as:

The code is in the attached image.

We can write the pseudcode as:

Integer netElevation(list of elements of type elevation - type and number)

function open

  Define running total = 0

  for each element from list

  loop open

      elevation type = element[i].type

     if (elevation type == Up)

          running total = running total + element[i].number

      else

          running total = running total - element[i].number

  loop close

  return running total

function close

See more about pseudcode at brainly.com/question/13302316

Ver imagen lhmarianateixeira