Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Lang Problem 1 - Name your class HikingForSloths You are hiking through the rainforests of Central America on a quest for sloths. Unlike sloths,

Java Lang image text in transcribed
Problem 1 - Name your class HikingForSloths You are hiking through the rainforests of Central America on a quest for sloths. Unlike sloths, you are a very efficient person. Hence, you want to use this trip for exercise as well as tinding sloths. Maybe you can be a role model for the sloths with your productivity Your phone has a fitness app installed that keeps track of your elevation as you hike. As you pass certain markers on the trail, the app automatically stores this elevation data into an array. For example, a trail with five markers might produce an array like this: 528.3 143.8 57.3 270.0 Low 4.1 Each element of the array represents the elevation (in feet above sea level) of that marker on the trail. (6 pts) A trail is considered "low altitude" if at least 60% of its markers have an elevation of 200 ft or lower The trail represented by the array above would be considered low altitude, since 3 in 5 (60%) of its markers have an elevation of 200 ft or lower. Write a method isLowAltitude that takes a 1D array of double values as a parameter and returns whether that trail is low altitude l. 2. (11 pts) Write a method showTrailData that takes a 1D array of double values as a parameter. The method should print the elevations on the trail. Each elevation should be separated from the next by one of these characters: ifthe trail gains elevation going to the next marker -if the trail stays at the same elevation going to the next marker if the trail loses elevation going to the next marker For example, calling your method with the array above as the argument should print 57.3 270.01-4.1/528.3 143.8 Hint: Since the backslash is an escape character, use " within a string to show the backslash character itself. (3 pts) Write a main method that creates an array with the data from the example above, then calls both of your methods and shows the results. You do not need to read any user input 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential Data Protection For Estate Agencies In Singapore 2024

Authors: Yang Yen Thaw Yt

1st Edition

B0CQK79WD3, 979-8872095392

More Books

Students also viewed these Databases questions

Question

10-9 How have social technologies changed e-commerce?

Answered: 1 week ago