If a person walks up a mountain for 18 minutes at 20mph and then returns down the same path at 60mph then his average speed was 30mph. Write a task that restores the average speed traveled if you are given the time to climb, the level of climbing and the level of descent. The rise time is given in minutes. Return the value as a whole number (mph). No wrapping is required. Examples aveSpd (18, 20, 60) <-> 30 aveSpd (30, 10, 30) 15 aveSpd (30, 8, 24) 12 Plese give solution in Java Script

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question
If a person walks up a mountain for 18 minutes at 20mph and
then returns down the same path at 60mph then his average
speed was 30mph.
Write a task that restores the average speed traveled if
you are given the time to climb, the level of climbing and
the level of descent. The rise time is given in minutes.
Return the value as a whole number (mph). No wrapping is
required.
Examples
aveSpd (18, 20, 60) <-> 30
aveSpd (30, 10, 30) → 15
aveSpd (30, 8, 24)
12
Plese give solution in Java Script
Transcribed Image Text:If a person walks up a mountain for 18 minutes at 20mph and then returns down the same path at 60mph then his average speed was 30mph. Write a task that restores the average speed traveled if you are given the time to climb, the level of climbing and the level of descent. The rise time is given in minutes. Return the value as a whole number (mph). No wrapping is required. Examples aveSpd (18, 20, 60) <-> 30 aveSpd (30, 10, 30) → 15 aveSpd (30, 8, 24) 12 Plese give solution in Java Script
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning