Course Level
CS1
Knowledge Unit
Fundamental Programming Concepts
Collection Item Type
Lab
Synopsis

In this lab, students track their own fitness activities for a week. They submit this data which becomes some of the test data for the lab. Based on the students' activities, the program computes the number of equivalent miles each student has walked and the total number of miles walked by everyone together. Output is sorted from most miles walked to least miles walked. 

This is a lab for late in the semester of a CS 1 course. It requires students to use text files and an array of structures.

Learning objectives:

  • Compiling, linking, executing a program
  • Developing an algorithm
  • Testing a program
  • Using the C++ syntax and programming constructs of standard I/O, variables and arithmetic expressions, selection statements, structures, arrays

Prerequisite knowledge: Students must have already been exposed to standard I/O, variables, arithmetic statements, selection statements, loops, functions, arrays, structures, and text files.

The lab could be easily modified to use a class instead of a structure and an array of objects.

Recommendations

Tips:

  • Allow students to add activities they engage in to the list of activities the lab tracks. If someone wants to add "Quidditch", then do it. The instructor should also track his/her activities to include in the input data. Discuss wearables and how they are used.
  • Consider donating $1 up to some amount (e.g., $100) for every mile walked as a group to a non-profit chosen by the students making the lab a kind of "Race for the Cure" event. This adds a service component to the lab. Alternatively, ask students to get sponsors who agree to donate a small amount of money for every mile the student "walks".
  • To create the text input file, give every student a sample Excel spreadsheet (in materials zip file). Copy the data to a single spreadsheet the save it as a space delimited file. Give this file to the students as one input file to test their program.  
  • There is a worksheet in the materials (in C++ syntax) that has students review the types of the data they will be using. Have students complete it in pairs, then review together. 
  • The Fitness Tracker Lab Test Cases document (provided below) is used by the instructor to evaluate the correctness of the program execution.

Pitfalls: 

  • Students may need guidance on the structure of the lab. For example, what functions should be written? 
  • Students may need guidance on a strategy to complete the lab with intermediate milestones. For example, students should write and test the code to read the data into the array of structures before tackling the remaining tasks.
Engagement Highlights

Student choice is incorporated by allowing students to add their own activities to the list of fitness activities that are tracked in the lab. The lab also incorporates student centered assessment by having students contribute to the test data.

The lab is interdisciplinary since it involves students tracking their own physical activities and writing code that would be part of a fitness tracking app. Fitness tracking apps and wearables are worn by many people. This makes the lab meaningful and relevant to the students.

Computer Science Details

Programming Language
C
C++
C#
Java

Material Format and Licensing Information

Creative Commons License
CC BY-NC-SA