Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fitbit is a company that builds wearable technology devices that track various activities. The devices have sensors that measure number of steps and distance walked,
Fitbit is a company that builds wearable technology devices that track various activities. The devices have sensors that measure number of steps and distance walked, heart rate, sleep quality, floors climbed, and calories burned. In this assignment, you will analyze data that was generated from a real Fitbit device. The data is stored in a comma-separated values (.csv) file that you will find at: http: //eecs.wsu.edu/-aofallon/cDts122/Drogassignments/FitbitData.csv. A .csv file stores data as plaintext in tabular form. Each row in the file is considered a record. Each record consists of fields separated by commas. In particular, you will analyze 24 hours of data. Each record in the "FitbitData.csv" represents one minute of data and consists of seven fields. These include the following: Minute Calories Distance (in miles) Floors Heartrate Steps Sleep level What data structures are required? In this assignment, you must define a C struct to store each of the Fitbit data fields as follows: typedef struct fitbit { char minute[9]: double calories: double distance: unsigned int floors: unsigned int heartRate: unsigned int steps: Sleep sleepLevel: } FitbitData: The type Sleep is enumerated and must be defined as follows: typedef enum sleep { NONE = 0, ASLEEP = 1, AWAKE = 2, REALLYAWAKE = 3 } Sleep: You must also define an array of FitbitData that can store 24 hours of minute data. Hence, you must declare an array of size 1440. You have the freedom to decide on other data structures and variables that you need for the assignment. What are the other requirements? This program does not require any user input! However, you will need to display some results to the screen! - You must open "FitbitData.csv" for mode read: check for success - You must read each record in the file as a string, one line at a time using fgets () - You must parse each record using strtok () from into the corresponding fields, and store into the FitbitData array: - You must compute the total calories burned, distance walked in miles, floors walked, and steps taken - You must compute average heartrate over the 24 hour period - You must report the max steps taken in one minute over the 24 hour period: if there are multiple minutes throughout the day where the max is discovered, then report the one that is the latest in the 24 hour period - You must report the longest consecutive range of poor sleep: a range is defined as one or more consecutive minutes where the sleepLevel > 1: the poorest sleep is not based on the length of the range, but the sum of the sleep levels in the range: the max sum of the ranges is considered the poorest sleep (report the starting and ending minutes of range) - You must open "Results.csv" for mode write: this will either create a new .csv or overwrite an existing one -You must output two lines to "Results.csv" and to the screen in the following format: Total Calories,Total Distance,Total Floors,Total Steps,Avg Heartrate,Max Steps,Sleep valueCalories,valueDistance,valueFloors,valueSteps,valueHeartrate, valueMax, valueSleepStart: valueSleepEnd - You must close "FitbitData.csv" and "Results.csv
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started