C++ Programming Internet Provider Anonymous Data Project
Imagine a fictitious Internet provider that keeps the following “anonymized” data about each of their customers and the services they purchase. The data is anonymous, as many modern data sets are, to allow the data to be processed with fewer privacy concerns.
Field Data Type
Customer ID string
StreamingMovies int
StreamingTV int
MultipleLines int
MonthlyCharges double
The fields are formatted as follows:
Customer ID takes the format one letter A-Z followed by 5 numbers 0-9. For example, A123, B777, C817 are all valid Customer IDs.
StreamingMovies, StreamingTV and MultipleLines are boolean values represented by 0 (false) or 1 (true). For example, if the customer record has “1′ for a StreamingMovies value, it means the customer subscribes to the StreamingMovies service.
MonthlyCharges is a floating point value, representing the customer’s monthly bill.
Write a C++ console program that prompts a user to enter attributes for three customers, and outputs the collected data in a formatted table.
Since the code block to prompt the user for attributes and cin and store their values is to be used three times instead of just one, write a generic value-returning function to do all that and return a “Customer’ data structure (struct). Call it three times from main once for each customer.
You may write a void function to output the result for a Customer struct, passed as a parameter to the function. Or do so in a code block in main your choice.
Here are other requirements:
Define a “struct Customer’ data type with the fields and types from the above table.
In the output, include table column headings, correctly-spaced.
The total of all column widths and the spaces separating them should not exceed 80 spaces.
You can use either cin >> for the attributes or getline().
Serialize down to customers.txt as the last thing that your program does. If you do this right, the file should have 15 lines 5 for each of the 3 objects.
We will not fully implement serialization in this assignment. But to prepare for it in later assignments, you’ll include “serializing down” int his one. It will have no effect on the program, because you won’t be serializing up. But it’s done this way here to get you used to making sure that serializing down works right before attempting add serializing up in all future work.
Optional Input Redirection
To save some typing (of each customer every time you run the program), you can add all your input into a TXT file (for example, input.txt). Something ike this:
A111
1
0
1
29.95
Like that, but with all three customers and all 5 attributes. If you do this right, it will be 15 lines long. Store the file in the same folder as your CPP. Then when you run, do this on a Windows PC (we will discuss in class how to do this with Code::Blocks):
a.exe < input.txt
"¦or this on a Mac:
./a.out < input.txt
Redirection Vs Serialization
If you think that serialization looks a lot like redirection, you are right! But serialization gets its input from fin, and redirection from cin. Because of that, the cout prompts do appear when using redirection nothing you can do about that except ignore the prompts. It's only for your development purposes anyway.
Submit your CPP for grading no TXT files please.
"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."
Recent Comments