Question: This assignment will give you practice with functions and vectors. I have given you a starter file called hurricane.cpp. You are free to create your






This assignment will give you practice with functions and vectors. I have given you a starter file called hurricane.cpp. You are free to create your solution from scratch. Create a program that will read data from a file called hurricanes.txt. The data will consist of a city's name, wind velocity and amount of rain for the hurricanes that occurred in the United States. The input process will be terminated by the EOF marker. Some cities will have a space in the name. (use the indata.ignore() statement where needed) Have the main function call a function to input the data from the file hurricanes.txt and store the data in 3 vectors, City, Wind, and Rain. The max number of elements is 50. However, the input function will keep track of the number of hurricanes and put that count in the variable numhurricanes. The Main Function should: 1. Declare all vectors and variables needed 2. Call the ReadData Function to read the data into the vectors a. Pass the arguments needed b. Open the file hurricanes.txt c. Use a while loop to read data into the vectors until EOF is reached d. close the file 3. Call the BSort Function to sort all three vectors by city. a. Use the selection sort to sort all three vectors simultaneously using numhurricanes. 4. Call the Print Vectors Function that prints the three vectors in tabular form with column headers 5. Call the ViolentWinds Function to print each city where the hurricane was violent. A Hurricane is violent if its windspeed is at least 120 mph. Display the city's name and windspeed with the header Violent Winds" 6. Call the Major Flood Function to print each city where the hurricane produced a flood. A flood occurs if its rainfall is at least 3.5 inches. Display the city's name and rainfall windspeed with the header Major Floods 7. Call the WindiestCity Function to return the vector position(hipos) of the city with the highest windspeed. 8. Call the AverWind Function to return the average wind velocity. 9. Call the AverRain Function to return the average rain fall. 10. Display the name of the city with the highest winds speed along with its windspeed. 11. Display the average wind speed with the proper label 12. Display the average rain fall with the proper label The Data file consist of: City Wind Rain Atlanta 130 Baltimore 120 Boca raton 137 Boston 130 Bowling Green 125 Cleveland 153 Dallas 89 Elizabeth City 85 Ellicot City 150 Houston 110 Key West 92 Merida 119 Miami 130 Morehead City 125 New England 110 New Jersey 93 New Orleans 84 New York 140 Norfolk 100 Orlando 130 Picqua 138 Pottersville 115 San Antonio 90 San Marino 110 Williamsburg 150 2.2 2.8 5.5 4.5 3.5 7.5 2.4 4.5 3.4 5.8 3.5 6.5 1.4 1.5 3.1 5.5 2.5 5.4 2.5 2.2 3.5 3.5 7.5 5.2 4.5 Cities with violent winds Atlanta 130 Baltimore 120 Boca raton 137 Boston 130 Bowling Green 125 Cleveland 153 Ellicot City 150 Miami 130 Morehead City 125 New York 140 Orlando 130 Picqua 138 Williamsburg 150 Cities with majors floods Boca raton 5.5 Boston 4.5 Bowling Green 3.5 Cleveland 7.5 Elizabeth City 4.5 Houston 5.8 Key West 3.5 Merida 6.5 New Jersey 5.5 New York 5.4 Picqua 3.5 Pottersville 3.5 San Antonio 7.5 San Marino 5.2 Williamsburg 4.5 Cleveland is the windiest city at 153mph. The average wind is 118.2 The average rain is 4.016 Dallas 89 Miami 130 Houston 110 5.8 New York 140 5.4 Cleveland 153 7.5 Atlanta 130 2.2 Orlando 130 2.2 Ellicot City 150 Baltimore 120 2.8 San Marino 110 5.2 Picqua 138 Bowling Green 125 3.5 Boston 130 New England 110 3.1 San Antonio 90 7.5 Pottersville 115 3.5 Williamsburg 150 New Jersey 93 5.5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Program #1 Hurricane Program // Programmer: Name Here // Class: CS 2020, SP 2022 // Due Date: Feb 7, 20212 // Purpose of program: Create a program that // will read data from a file called hurricanes.txt. // The data will consist of a city's name, wind velocity [//and amount of rain for the hurricanes that occurred in the United States. #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
