DataWrangler, CS161, C++ using QTCreator Objective Upon completion of this assignment the student will be able to use st

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

DataWrangler, CS161, C++ using QTCreator Objective Upon completion of this assignment the student will be able to use st

Post by answerhappygod »

DataWrangler, CS161, C++ using QTCreator
Objective
Upon completion of this assignment the student will be able to
use structs and arrays to store data from a file and perform
various computations on.
Overview
Your program should read data from a text file into an array of
structs and then do some interesting work with the data. It should
not require any input from the user. Instead, it should have some
hard-coded behavior that reads in the database and prints out some
clearly labeled output (as described below).
You can use any data set you want as long as it has at least 100
records and each record consists of at least 4 fields that are not
all text (it must have at least one numeric field that you use).
Here are some sample data sets you might use:
The provided files, and many others you might find, are in
comma-separated values (csv) format. A csv file is just a text file
where each record is on one line of the file and there is a comma
separating adjacent fields of the record. For example, the
following csv data encodes two records, and each record has three
fields.
You can open and read them just like you would any text file
(just make sure to use the appropriate filename, likely ending in
.csv rather than .txt).
Here are some spots to look for other data sets:
Files to submit
Part 1: Parse the data File
Your program should read in the data file to some combination of
arrays and structs sufficient to hold the data. It is okay to hard
code the number of records your program will work with to match the
number of rows in your file, and it is okay to only read in the
first X number of records, as long as your program deals with
at least 100 records.
It is also okay to use only some of the fields from each record
in the file, either by removing them while you clean the data, or
by just not doing anything with them as you read them in. However,
you must work with at least four fields for each record,
and at least one must not be a string (be numeric).
You should store all pieces of data as an appropriate type. If a
line from your data file looks like:
The 21 and 98.4 should be stored as an int and
a double, not as the strings "21" and "98.4".
As you read the file, you will have to account for the fact that
pieces of data are separated by commas instead of spaces or tabs.
Reading from a file with >> doesn't stop until it reaches
whitespace, so 123,Max would all come through as one big string.
You will probably want to use getline to read a whole line at once
into a string and then break it into parts yourself.
When working with real data files like we are in this
assignment, hand cleaning your data often makes it vastly easier to
write code to work with the data - it allows you to avoid dealing
with lots of special weird cases.
In particular, if your data file has commas or quote marks in
it, you will want to clean up the file by getting rid of them.
It is HIGHLY suggested that you clean up your data
file before trying to write your program. See the appendix
at the end of this document for instructions on how to do so.
You must open the file using a relative path, not an absolute
path. (An absolute path is something like
C:\Users\YourName\...\datafile.csv, and won't work when your
submission is moved to my computer for testing.) If the data
file you include with your submission is named datafile.csv, your
program should open it using just datafile.csv as the path.
To read in a large number of records (thousands), you may need
to allocate your array on the heap using new. We will talk about
that in week 10; until that point stick to no more than 1000 pieces
of data.
Part 2: Print part of the file
Your program should demonstrate that the data was read correctly
by printing the first three records and then the last three records
your read. If you read 1000 records, you should print out 0-2 and
997-999.
Your writeup must include example output from running your
program.
Part 3: Find max/min
Your program must be able to find the maximum, minimum, or range
of values for records that match some criterion. For example:
You should demonstrate doing this work for two different
examples. For instance - if you were using the google app store
data, you might first find and print the highest rated app for the
ART_AND_DESIGN category and then do the same for the BEAUTY
category. (Hard code these samples - your program should not ask
for input.)
Your writeup must describe what the functions does and include
example output from running your program.
Part 4: Aggregate data
The program must be able to compute a total, average, or other
aggregated statistic about all items that match some criterion. For
example:
You should demonstrate doing this work for two different
examples. For instance - if you were using the quarterback data,
you might first find and print the total career touchdowns for
Montana, Joe and then print out the total career touchdowns for
Marino, Dan.
Your writeup must describe what the functions does and include
example output from running your program.
Part 5: Find matching records
Your program must be able to find and print all the records that
match a particular criterion. For example:
You should demonstrate doing this work for two different
examples. For instance - if you were using the employee data, you
might first find and print all the records for employees returning
$50 to $100,000 then do the same for $100-200,000.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply