Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create the Trail class. Your class will include an array of integers that will use the following elevation values using the index as
1. Create the Trail class. Your class will include an array of integers that will use the following elevation values using the index as the marker. Trail Elevation (meters) Index 0 1 2 3 4 5 6 7 8 9 10 11 12 Elevation 100 150 105 120 90 80 50 75 75 70 80 90 100 Your Trail class must include a constructor that has two integer values start and end which will represent where you will start and end on the Trail. Your class must include two methods, The first method is TrailLevel will return true if the difference between the maximum and minimum elevation on the Trail is less than or equal to 10 meters. Your second method is Trail Difficult will return true If the Trail is determined to be difficult and false If not. To determine if the Trail is difficult you must track elevation changes that greater than or equal to 30 meters between two consecutive markers, A trail with 3 or more such changes is rated as difficult. FOR EXAMPLE: A trail segment starting at marker 7 and ending at marker 10 has a minimum elevation of 70 meters and maximum elevation of 80 meters. Since the difference between the minimum and maximum elevation is less than or equal then 10 meters, this trail segment is considered level and should return true. A trail segment starting at marker 2 and ending at marker 12 has a minimum elevation of 50 meters and a maximum elevation of 120 meters, Since the difference between the minimum and maximum elevation is greater than 10 meters, this trail segment is not considered level and should return false.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started