+1 (315) 557-6473 

Highest Quality Input Data File Program Homework Help Using C++

We are the number one provider of top-grade input data file program homework help service. We know for you to submit quality solutions, your homework must be prepared by seasoned experts. As a result, we have hired skillful C++ homework tutors to assist you. If you have any doubts about your homework , then do not hesitate to take our reliable input data file program homework help. The best thing about our service is you can get in touch with us at any time of the day or night.

Custom Input Data File in C++

First, create a custom input data file. The file contains the name of a town and seven population values. The name of the town will be your first name. The seven population values will be derived from the digits in your ACCeID. It will be a text file and can be made with any text editor, such as notepad. You can use your C++ programming editor. Do not use any punctuation or special characters. To create your input data file.
Get your ACCeID. This starts with one lowercase letter, followed by 7 digits. The first letter is usually the first letter of your first name. Example: Abernathy Zappa’s ACCeID is: a1234567.
Enter your first name represented by the letter. Then multiply each digit by 1000 and separate with some whitespace. Whitespace can be one or more spaces, tabs or newlines. Create the following data (example):Abernathy 1000 2000 3000 4000 5000 6000 7000
If a digit is a 0, use 9 instead. The problem with 0 is that no data is displayed in the chart. For example: Mindobiz Soo’s ACCeID is: m7032901. The data file will contain:Mindobiz 7000 9000 3000 2000 9000 9000 1000
Save this to a file; use the file naming convention, but use a .txt extension, not .cpp. For example:
DLS_L5_Lastname.txt. For the examples above, the filenames would be: DL1_L5_Zappa.txt or DL1_L5_Soo.txt, assuming a section number of 1. Use your section number.

A Program that Reads Data from the File

Next, write a program to read the data from this file and display a population bar chart. The program should:
Read the file DLS_L5_Lastname.txt made above. If the file is not found, handle the situation appropriately with a good error message, including the name of the file not found, then stop. Do not attempt to display a chart if no data is available. If the file opens OK, read the name of the town. At the top, display a title so the user knows what this chart represents. Use toupper on each letter of the name so the name is fully uppercase. For example, display:
ABERNATHY POPULATION GROWTH
(each * represents 1000 people)
2) Use all the data in the file to display a bar chart showing population growth.
3) Make the program more flexible: read population values from the file until end-of-file (instead of 7 times). It should work if there are more or less than 7 population values. Handle population values until end of file.
Example output: (bar chart)
MINDOBIZ POPULATION GROWTH
 (each * represents 1000 people)
1900 *******
1920 *********
1940 ***
1960 **
1980 *********
2000 *********
2020 *
You program can assume:
1) Population numbers start at the year 1900 (or 1910); (some textbook editions start at 1900, some start at 1910; it doesn't really matter)
 2) Population counts are provided in 20 year increments; 3) seven population counts provided. For working code that reads data from a file, see: "Program Samples", Simple FileIO. This provides a complete, working FileIO example.

C++ Code Solution

#include
#include
#include
#include
using namespace std;
// Entry point of the program
int main()
{
 // Open the file
 ifstreaminFile("DL1_L5_Maria.txt");
 // Stop program if it can't be opened.
 if (!inFile.is_open())
 {
  cout<< "Error: Failed to open input file DL1_L5_Maria.txt" <
  return 0;
 }
 // Read the title
 stringtownName;
 inFile>>townName;
 // Convert all letters of town name to upper case
 for (unsigned i = 0; i
  townName[i] = toupper(townName[i]);
 // Display a bar chart for each year from 1900 onwards with increments of 20 years
 cout<
 cout<< " (each * represents 1000 people)" <
 int population;
 for (int year = 1900; inFile>> population; year += 20)
 {
  cout<< year << " ";
  for (inti = 0; i< population; i += 1000)
   cout<< "*";
  cout<
 }
 inFile.close();
 return 0;
}

Related Blogs