Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to anal
ID: 3711069 • Letter: U
Question
Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to analyze the data from the number of visitors to Sleeping Bear Dunes in Michigan in 2015.
Requirements
Read the data from the Months.txt and Visitors.txt files. The text files are provided for you to download. The data was obtained from the National Park Service website.
Design the program so the user enters a menu item and the following is displayed
Display the chart below
Totals and display all visitors to the dunes.
Total and display each month (add across the rows (except the Total Overnight Stays).
Display the percentage of Total Overnight Stays compared to total visits. (Total Overnight Stays/(Recreation Visitors + Total Overnight Stays)
Design the program so the user can continuously enter a menu item and terminate the program when done.
Visitors.txt files:
Months txt files:
To complete this assignment, please use Mcrosoft Visual Studio 2017 C", and write program to calculate to analyze the data from the nunaber of visitors to Sleeping Bear Dunes in Michigan in 2015. Requirements 1. Read the data from the Moriths.tat and Visitors.txt files. The text files are provided for you to download. The data was obtained from the National Park Service website. Desgn the prugram so the user enters a menu item and the following is displayed 2. . Display the chart below h. Totals and display all visitors to the dunes c. Total and display each month (add across the rows (except the Total Overnight Stays). d. Display the percentage of Tatal Overnight Stays compared to total visits. Total Overnight Stays//Recreation Visitors Total Overnight Stays) 3. Design the program so the user can continuausly enter a menu item and terminate the program when done. Sleeping Bear Dunes NL Tent or Compers RV Campers Beckcountry Total Campers Overnight 6,340 12.191 1,548 February March Apr May June 14 24 231 1,890 1.363 8 823 10.346 10.492 164 10 74,361 256,462 483,291 358,885 141,297 119,175 2,764 4,879 13,707 3,100 8,045 581 5,755 8,970 29,658 31,262 2290 21,728 1,101 2,727 7,034 7816 Octobar November December 2015 Totals 281 9,638 13,653 24 20 1.535.63347,41040,023 21,327 108,761 F5Explanation / Answer
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
//main program
int main(){
//creating file objects for both files
ifstream file1, file2;
//opening the input files
file1.open("Moths.txt");
file2.open("Visitors.txt");
string s;
//reading and printing all visitors
cout << "Visitors";
while(file1 >> s){
cout << s<<" ";
}
//reading all months data and printing the sum for each month
string month;
int month_sum = 0;
int dummy = 0;
while(!file2.eof()){
cout << "Month : " << (file2 >> month) ;
while(file2 >> dummy){
month_sum = month_sum+ dummy;
}
cout << " sum :"<< month_sum;
}
}