Question
URGENT TASK Task 1: National Blue Trail tracks (1-tracks, 8 pts) With high inflation such nowadays, we think twice about what we spend our money
Task 1: National Blue Trail tracks (1-tracks, 8 pts)
With high inflation such nowadays, we think twice about what we spend our money on. Expensive vacations can be replaced by excursions and the discovery of the natural wonders of Hungary. The National Blue Trail, which runs through the mountains from the western end of Hungary to the eastern end, is perfectly suitable for this. In order to select a section of this long trail, it would be good to know what parameters they have and how difficult they are. The $tracks
array in the index.php
file contains some of the most important data of all the 27 sections of the National Blue Trail (the number, the name of one and the other end of the section, the length of the track in km, the elevation in m, and the time in minutes). Display it as follows:
- a. (2 pts) Display the data as a table. Look for an example in
index.php
! The time must be shown in hours; steepness is the elevation per kilometer (level/distance); and the velocity is the distance traveled during the unit of time (distance/time, km/h)! - b. (2 pts) Mark the length of the roads on a green-red color scale as the background colour of the distances! To do this, find the largest distance value, then for each section, calculate the percentage of the given section compared to the longest! (E.g. if the longest section is 72km, and the actual is 36km, then the percentage value is 50%.) This % value must be projected onto the 0-120 interval of the Hue value of the HSL color scale, so that 0% corresponds to the hue value 120, and 100% to the hue value 0. In CSS, an HSL value including transparency can be specified as follows:
hsla(0, 100%, 60%, 0.5)
. The current Hue value must be specified as the first parameter! - c. (1 pt) Apply the same coloring to the elevation and steepness columns, as well!
- d. (1 pt) We also color the background color of the cells of the velocity column, but here in such a way that we first find the largest and smallest value, then the value of each section is given as a percentage compared to this interval (e.g. slowest 2km/h, fastest 8km/h, actual 5km/h is 50%), and this is colored so that the red (hue=0) should be at the smallest value, and green (hue=120) at the largest!
- e. (2 pts) Sum up the distance, elevation and time columns in the last row of the table!
Help: feel free to look around PHP's array functions to see if you can find efficient solutions, such as the array_column
(Links to an external site.) function!
INDEX.PHP
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