Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to anal

ID: 3709312 • 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.

Sleeping Bear Dunes NL 2015

January Recreation Visitors - 6,340 Tent Campers - 27 RV Campers - 34 Backcountry Campers - 6 Total Overnight Stays - 67

February 12,191 7 7 2 16

March 11,548 14 24 10 47

April 36,053 323 231 27 581

May 74,361 2,764 1,890 1,101 5,755

June 256,462 4,879 1,363 2,727 8,970

July 483,291 13,797 8,823 7,038 29,658

August 358,885 13,100 10,346 7,816 31,262

September 141,297 8,945 10,492 2,290 21,728

October 119,175 3,193 6,164 281 9,638

November 22,377 337 629 22 988

December 13,653 24 20 7 51

2015 Totals 1,535,633 47,410 40,023 21,327 108,761

Explanation / 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;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote