Question: You are tasked with creating a program that collects snowfall data at the Taos Ski Area for a specific period and then sorts it using

You are tasked with creating a program that collects snowfall data at the Taos Ski Area for a specific period and then sorts it using a sorting algorithm. The program should allow the user to input the snowfall data, store it in a structure array, sort it, and display the results.
Instructions:
Define a structure called SnowfallData with the following members:
date (a string to store the date in MM/DD format) inches (a floating-point value to store the snowfall inches)
The main function should accept the entry from the user of an integer for number of days to be collected. It should define the structure object and call the additional functions.
In addition to the main function, write the following functions:
inputSnowfallData: Is passed the array and integer n from main (the number of snowfall data entries) and prompts the user to input the data (date and snowfall inches) for each entry. Store the data in the array. sortSnowfallData: Implements a sorting algorithm to sort the snowfall data based on the date. displaySortedData: Displays the sorted data (dates and corresponding snowfall inches) in ascending order by date.
Sample Dialog: Suppose the user enters the following data:
Enter the number of snowfall data entries: 5
Enter date (MM/DD): 01/15
Enter snowfall inches: 3.5
Enter date (MM/DD): 01/16
Enter snowfall inches: 2.0
Enter date (MM/DD): 01/14
Enter snowfall inches: 1.8
Enter date (MM/DD): 01/17
Enter snowfall inches: 4.2
Enter date (MM/DD): 01/13
Enter snowfall inches: 2.5
5. Your program should output:
Sorted Snowfall Data at the Taos Ski Area
-----------------------------------------------------------
01/13: 2.5 inches
01/14: 1.8 inches
01/15: 3.5 inches
01/16: 2.0 inches
01/17: 4.2 inches
Validations:
The number of data entries (n) should be at most 100. Snowfall inches should be positive floating-point values. Date can be an unvalidated string

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!