Question: In Perl programming 1. Hotels are often rated using stars to represent their score. A five-star hotel may have a king-size bed, a kitchen, and
1. Hotels are often rated using stars to represent their score. A five-star hotel may have a king-size bed, a kitchen, and two TVs; a one-star hotel may have cockroaches and a leaky roof. a. Write a subroutine called printstar that will produce a histogram to show the star rating for hotels shown in the following hash. The printstar function wll be given two parameters: the name of the hotel and the number of its star rating. (Hint: sort the hash keys into an array. Use a loop to iterate through the keys, calling the printstar function for each iteration.) %hotels-("Pillowmint Lodge"-> "5", "Buxton Suites">"5" "The Middletonian" "3", "Notchbelow" "Rancho El Cheapo""", "Pile Inn'" "4 (OUTPUT) Hotel Category Notchbelow The Middletonian Pillowmint Lodge**** Pile Inn Rancho El Cheapo Buxton Suites b. Sort the hotels by stars, five stars first, one star last. Can you sort the hash by values so that the five-star hotels are printed first, then four, and so forth? (See httpllalvinalexander.com/peredulgandalplaa00016) Hotel Category Buxton Suites Pillowmint Lodge* Notchbelow The Middletonian **I Pile Inn Rancho El Cheapo
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
