Question

Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to analyze the data...

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

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#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<<"\n";

}

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

}

}

Add a comment
Know the answer?
Add Answer to:
Using Microsoft Visual Studio 2017 C++, write a C++ program to calculate to analyze the data...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to...

    C++ and Using Microsoft Visual Studio. Write 2 programs: One program will use a structure to store the following data on a company division: Division Name (East, West, North, and South) Quarter (1, 2, 3, or 4) Quarterly Sales The user should be asked for the four quarters' sales figures for the East, West, North, and South divisions. The data for each quarter for each division should be written to a file. The second program will read the data written...

  • Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment...

    Microsoft Visual Studios 2017 Write a C++ program that computes a student’s grade for an assignment as a percentage given the student’s score and total points. The final score must be rounded up to the nearest whole value using the ceil function in the <cmath> header file. You must also display the floating-point result up to 5 decimal places. The input to the program must come from a file containing a single line with the score and total separated by...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT