Untitled 6 ASSIGNMENT2 Assignment Specifications XXXXXXXXXXpoints The file named catastrophe.txt contains the data set. Each line of the file contains the information of catastrophe which includes:...

1 answer below »
Referencing style not applicable, needs to be done as if a beginner completed it


Untitled 6 ASSIGNMENT2 Assignment Specifications 50 points The file named catastrophe.txt contains the data set. Each line of the file contains the information of catastrophe which includes: name, disaster, year, Loss of property(million of dollars),Deaths, There is a comma character between fields. The program will input the data set and list of catastrophe. If the list of catastrophe cannot be constructed, the program will display an appropriate error message and halt. The program will display a menu of options and allow the user to search for catastrophe which meet certain criteria. The menu options are: 1. Display all catastrophe in a year range: Prompt the user for two years (a starting year and an ending year), then display all catastrophe between those two years (inclusive). For example, if the user entered “2015” and “2018”, display all catastrophe 2015,2016,2017,2018. 2. Search for an disaster: Prompt the user for a string, then display unique years when that disaster happens information whose disaster name contains that string (regardless of case). For example, if the user enters “FLOODING”, display all catastrophe whose disaster name contains (or matches) the string “flooding”, “Flooding”. 3. SUMMARY REPORT: Generate a text file with list of disasters per year and Total deaths per year. Sample summary report is shown below. Assignment Notes 1. Your program will consist of at least 3 functions: a separate function to process each of the 3 menu options listed above. 2. You may use arrays or vectors to store the data. 3. Be sure to display the information in a reasonable and readable manner. 4. If no catastrophes are found for a particular search, your program will display an appropriate message (rather than simply displaying nothing). ASSIGNMENT2 Sample Output: What would you like to do? 1: Look up year range 2: Look up disaster 3: Generate summary report Select an option : 1 Enter beginning year: 2018 Enter ending year: 2019 All Disasters between 2018 and 2019 : Central and Eastern Winter Storm (January 2018) Northeast Winter Storm (March 2018) Southeastern Tornadoes and Severe Weather (March 2018) Southern and Eastern Tornadoes and Severe Weather (April 2018) Central and Northeastern Severe Weather (May 2018) Central and Eastern Severe Weather (May 2018) Texas Hail Storm (June 2018) Southeast, Ohio Valley and Northeast Severe Weather (February 2019) Texas Hail Storm (March 2019) South and Southeast Severe Weather (May 2019) Rockies, Central and Northeast Tornadoes and Severe Weather (May 2019) What would you like to do? 1: Look up year range 2: Look up disaster 3: Generate summary report Select an option:2 Enter an Disaster name: Flooding Years when disaster happened are: 2013,2014,2015,2016,2017 What would you like to do? 1: Look up year range 2: Look up disaster 3: Generate summary report Select an option:3 Enter output file name: Disasters_summary.txt Year; Disasters; Total deaths 2018; Winter storm,Severe Storm ; 39 2019;Severe Storm;4 NOTE: Sample data of Disasters_summary.txt for 2018 and 2019 is shown here. Generate for all the years. "Plains/East/Northeast Severe Weather (June-July 2012)","Severe Storm",2012,3264.0,28 "Hurricane Isaac (August 2012)","Tropical Cyclone",2012,3122.8,9 "Hurricane Sandy (October 2012)","Tropical Cyclone",2012,73494.6,159 "Western Wildfires (Summer-Fall 2012)","Wildfire",2012,1964.6,8 "U.S. Drought/Heatwave (2012)","Drought",2012,33903.9,123 "Southeast Severe Weather (March 2013)","Severe Storm",2013,2242.2,1 "Midwest/Plains Severe Weather (April 2013)","Severe Storm",2013,1602.9,1 "Illinois Flooding and Severe Weather (April 2013)","Flooding",2013,1195.6,4 "Midwest/Plains/East Tornadoes (May 2013)","Severe Storm",2013,2664.4,27 "Midwest/Plains/Northeast Tornadoes (May 2013)","Severe Storm",2013,2013.0,10 "Midwest Severe Weather (August 2013)","Severe Storm",2013,1156.6,0 "Colorado Flooding (September 2013)","Flooding",2013,1674.4,9 "Ohio Valley Tornadoes (November 2013)","Severe Storm",2013,1210.7,8 "Western/Plains Drought/Heatwave (Spring-Fall 2013)","Drought",2013,11573.2,53 "Midwest/Southeast/Northeast Winter Storm (January 2014)","Winter Storm",2014,2368.2,16 "Plains Severe Weather (April 2014)","Severe Storm",2014,1552.2,0 "Midwest/Southeast/Northeast Tornadoes and Flooding (April 2014)","Severe Storm",2014,1892.4,33 "Rockies/Midwest/Eastern Severe Weather (May 2014)","Severe Storm",2014,4047.5,0 "Rockies/Central Plains Severe Weather (June 2014)","Severe Storm",2014,2091.9,2 "Michigan and Northeast Flooding (August 2014)","Flooding",2014,1124.6,2 "Rockies/Plains Severe Weather (September 2014)","Severe Storm",2014,1526.5,0 "Western Drought (2014)","Drought",2014,4327.4,0 "Central and Eastern Winter storm Cold Wave (February 2015)","Winter Storm",2015,3258.4,30 "Midwest/Ohio Valley Severe Weather (April 2015)","Severe Storm",2015,1711.1,2 "South/Southeast Severe Weather (April 2015)","Severe Storm",2015,1412.3,0 "Southern Plains Tornadoes (May 2015)","Severe Storm",2015,1399.3,4 "Texas and Oklahoma Flooding and Severe Weather (May 2015)","Flooding",2015,2750.7,31 "Central and Northeast Severe Weather (June 2015)","Severe Storm",2015,1289.1,1 "South Carolina and East Coast Flooding (October 2015)","Flooding",2015,2198.0,25 "Western and Alaskan Wildfires (Summer-Fall 2015)","Wildfire",2015,3330.8,12 "Texas Tornadoes and Midwest Flooding (December 2015)","Severe Storm",2015,2158.2,50 "Western Drought (2015)","Drought",2015,4912.6,0 "Southeast and Eastern Tornadoes (February 2016)","Severe Storm",2016,1123.3,10 "Texas and Louisiana Flooding (March 2016)","Flooding",2016,2478.4,5 "Southern Severe Weather (March 2016)","Severe Storm",2016,1307.1,1 "North Texas Hail Storm (March 2016)","Severe Storm",2016,2229.9,0 "North/Central Texas Hail Storm (April 2016)","Severe Storm",2016,3778.5,0 "Houston Flooding (April 2016)","Flooding",2016,2890.1,8 "South/Southeast Tornadoes (April 2016)","Severe Storm",2016,2586.0,6 "Plains Tornadoes and Central Severe Weather (May 2016)","Severe Storm",2016,1857.3,2 "Rockies/Central Tornadoes and Severe Weather (May 2016)","Severe Storm",2016,1237.9,0 "West Virginia Flooding and Ohio Valley Tornadoes (June 2016)","Flooding",2016,1046.3,23 "Rockies and Northeast Severe Weather (July 2016)","Severe Storm",2016,1582.9,0 "Louisiana Flooding (August 2016)","Flooding",2016,10800.0,13 "Hurricane Matthew (October 2016)","Tropical Cyclone",2016,10800.0,49 "Western/Southeast Wildfires (Summer-Fall 2016)","Wildfire",2016,2586.6,21 "West/Northeast/Southeast Drought (2016)","Drought",2016,3729.2,0 "Southern Tornado Outbreak and Western Storms (January 2017)","Severe Storm",2017,1160.4,24 "California Flooding (February 2017)","Flooding",2017,1575.0,5 "Central/Southeast Tornado Outbreak (March 2017)","Severe Storm",2017,1896.7,6 "Midwest Tornado Outbreak (March 2017)","Severe Storm",2017,2285.0,2 "Southeast Freeze (March 2017)","Freeze",2017,1050.0,0 "South/Southeast Severe Weather (March 2017)","Severe Storm",2017,2829.8,0 "Missouri and Arkansas Flooding and Central Severe Weather (May 2017)","Flooding",2017,1742.3,20 "Colorado Hail Storm and Central Severe Weather (May 2017)","Severe Storm",2017,3517.5,0 "Minnesota Hail Storm and Upper Midwest Severe Weather (June 2017)","Severe Storm",2017,2467.5,0 "Midwest Severe Weather (June 2017)","Severe Storm",2017,1584.7,0 "Midwest Severe Weather (June 2017)","Severe Storm",2017,1496.3,0 "Hurricane Harvey (August 2017)","Tropical Cyclone",2017,130000.0,89 "Hurricane Irma (September 2017)","Tropical Cyclone",2017,52000.0,97 "Hurricane Maria (September 2017)","Tropical Cyclone",2017,93600.0,2981 "Western Wildfires California Firestorm (Summer-Fall 2017)","Wildfire",2017,18725.2,54 "North Dakota South Dakota and Montana Drought (Spring-Fall 2017)","Drought",2017,2600.0,0 "Central and Eastern Winter Storm (January 2018)","Winter Storm",2018,1074.4,22 "Northeast Winter Storm (March 2018)","Winter Storm",2018,2259.9,9 "Southeastern Tornadoes and Severe Weather (March 2018)","Severe Storm",2018,1495.7,0 "Southern and Eastern Tornadoes and Severe Weather (April 2018)","Severe Storm",2018,1344.4,3 "Central and Northeastern Severe Weather (May 2018)","Severe Storm",2018,1432.0,0 "Central and Eastern Severe Weather (May 2018)","Severe Storm",2018,1397.5,5 "Texas Hail Storm (June 2018)","Severe Storm",2018,1326.0,0 "Southeast Ohio Valley and Northeast Severe Weather (February 2019)","Severe Storm",2019,1249.9,2 "Texas Hail Storm (March 2019)","Severe Storm",2019,1403.9,0 "South and Southeast Severe Weather (May 2019)","Severe Storm",2019,1090.0,0 "Rockies Central and Northeast Tornadoes and Severe Weather (May 2019)","Severe Storm",2019,2546.0,2
Answered 1 days AfterOct 07, 2021

Answer To: Untitled 6 ASSIGNMENT2 Assignment Specifications XXXXXXXXXXpoints The file named catastrophe.txt...

Darshan answered on Oct 09 2021
127 Votes
// C program for the above approach
//name, disaster, year, Loss of property(million of dollars),Deaths,
// Driver Code
#includeh>
#include
#include
char copy[10][5];
char * pointer;
char * start;
int print_data(int option,char year1[5],char year2[5],char str[20]);
int getSize(char* filename)
{
int rows=0;
FILE* file = fopen("catastrophe-i22msy2h.txt", "r");
char line[1024];
while (fgets(line, 1024, file) != NULL)
{
rows++;
}
return rows;
}
    int rowsData = 0;
    int column=0;
int main()
{
    int input;
    char year1[5],year2[5];
    char str[20];
    char userfile[100];
    char user;
    
    printf("What would you like to do?\n");
    printf("1: Look up year range\n");
    printf("2: Look up disaster\n");
    printf("3: Generate summary report\n");
    printf("Select an option : \n");
    scanf(" %d",&input);    
    switch(input)
    {
            case 1:
                    printf(" Enter beginning year: ");
                    scanf(" %s",year1);
                    printf(" Enter ending year: ");
                    scanf(" %s",year2);
                    print_data(1,year1,year2,"");
            break;
    
            case 2:
                    printf("Enter an Disaster name: ");
                    scanf(" %[^\n]%*c", str);
                    printf("%s", str);
                    print_data(2,year1,year2,str);
            break;    
    
            case 3:
                    printf("Enter output file name: ");
                    scanf(" %[^\n]%*c", userfile);
                    printf("%s",...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here