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 MMDD format inches a floatingpoint 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:
Enter date MMDD:
Enter snowfall inches:
Enter date MMDD:
Enter snowfall inches:
Enter date MMDD:
Enter snowfall inches:
Enter date MMDD:
Enter snowfall inches:
Enter date MMDD:
Enter snowfall inches:
Your program should output:
Sorted Snowfall Data at the Taos Ski Area
: inches
: inches
: inches
: inches
: inches
Validations:
The number of data entries n should be at most Snowfall inches should be positive floatingpoint 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
