C++ PROGRAM HELP!!!!! Write a program to analyze death statistics provided by th
ID: 3719289 • Letter: C
Question
C++ PROGRAM HELP!!!!!
Write a program to analyze death statistics provided by the US government...
THIS PROGRAM WILL ACCESS A .CSV FILE FROM THE USER AND YOU SHOULD BE ABLE TO DO THE FOLLOWING:
The bolded columns are the cells that you will need to collate for this assignment. From this data, you must allow the user to make several queries:
List total deaths for a given state
List deaths by cause for a given state
List death rates by year for a given state and a given cause
List total death rates by year for a given state
List total deaths for each cause for all states
List total deaths for all causes for all states
List death rates by year for all states and a given cause
List total death rates by year for all states
SHOULD LOOK LIKE THIS:
***Death Rate Data Analysis***
Enter State (-1 for all states): California
Enter Cause (-1 for all causes): Unintentional Injuries
Do you want this data broken down by year (Y/N)?: N
Total deaths in California from Unintentional Injuries in the years 1999 to 2015: 180908
Would you like to run another query (Y/N)?: N
GIVEN STRINGSPLITTER TO HELP PARSE THE FILE....
#endif
***Death Rate Data Analysis***
Enter State (-1 for all states): California
Enter Cause (-1 for all causes): Unintentional Injuries
Do you want this data broken down by year (Y/N)?: N
Total deaths in California from Unintentional Injuries in the years 1999 to 2015: 180908
Would you like to run another query (Y/N)?: N
Explanation / Answer
Could u please share with me the .CSV file?
GIVEN STRINGSPLITTER TO HELP PARSE THE FILE....
#endif
#ifndef STRINGSPLITTER_H #define STRINGSPLITTER_H #include <string> #include <vector> using namespace std; class StringSplitter { public: //Accepts a string and a delimiter. Will use items_found to return the number //of items found as well as an array of strings where each element is a piece of //the original string. static vector<string> split(string text, string delimiter) { //vectors are dynamically expanding arrays vector<string> pieces; //find the first delimiter int location = text.find(delimiter); //we are starting at the beginning of our string int start = 0; //go until we have no more delimiters while(location != string::npos) { //add the current piece to our list of pieces string piece = text.substr(start, location - start); pieces.push_back(piece); //update our index markers for the next round start = location + 1; location = text.find(delimiter, start); } //at the end of our loop, we're going to have one trailing piece to take care of. //handle that now. string piece = text.substr(start, location - start); pieces.push_back(piece); return pieces; } };#endif
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.