CSCI0050 Creating Data Assignment
1 Designing Data (Everyone)
2 Option 1 (Standard):   Programming With To-Do Items
3 Option 2 (Challenging):   Programming With Flights
CSCI0050 Homework: Creating and Processing Data

Due: Friday, July 21 at 6pm (submit through Canvas)

Assignment Goals:
  • To practice designing data layouts

  • To practice creating data blocks and programming with them

Collaboration Policy: This is an individual assignment. Include a collaboration statement attesting that you did this work on your own.

In this assignment, there is a common task for all (designing data), and a choice of one of two sets of programming problems: one on writing programs over to-do items and one on writing programs over flights. The flights assignment is more challenging. Pick whichever set is more appropriate for your progress with the material. You don’t get extra points for trying the challenge problems: my goal is simply to provide a more challenging option for those who are ready for it (and you won’t adversely affect your grade by trying those problems if you are ready for them). Feel free to ask me if you are trying to decide which problems to attempt.

1 Designing Data (Everyone)

The answers to this part go in a file named data.arr.

For the two problems in this section, you are not writing any functions. You are simply defining data structures (tables, lists, data blocks, etc) to capture the requested information. For each, provide:

There is no single right answer to these (though some answers are better than others). The goal here is to let us assess how you are thinking about data at this point in the course). Both problems are about data that you have some experience with—think about the kinds of operations or functions that one might want to do with that data and let that influence your data choices.

2 Option 1 (Standard): Programming With To-Do Items

The answers to this part go in a file named todo.arr.

Do these problems using the data structure that you designed for the previous part, if possible. If you find the data structure you wrote for part 1 doesn’t work for these problems, make a new data structure for part 2 and explain why what you had in part 1 didn’t work out as you had hoped.

The problems use the phrase "collection of to-do items" so as not to bias your choice of data structure.

3 Option 2 (Challenging): Programming With Flights

The answers to this part go in a file named flights.arr.

An airline maintains information on flights as a list of flight-values defined with the following data blocks:

  data FlightInfo:

    | flight(

        from-city :: String,

        to-city :: String,

        departure :: Time,

        arrival :: Time

      )

  end

  

  # hm-time is for 24-hour format

  data Time:

    | hm-time(

        hours :: Number,

        mins :: Number

        )

  end

Using these data blocks, write the following two functions:

Tips and Hints (Flights Problems)

The flights problems are a non-trivial jump over the problems we have tried so far. If you try those:

Grading and Expectations

For the data-design problems, we are looking for whether you make reasonable choices and give appropriate justifications for them. These exercises count towards the "data structures" theme of the course.

For the programming problems (either set), we will look at your examples/tests, code structure, and code presentation. We expect you to follow the list template when appropriate (unless you are using a built-in list iterator like map or filter, which you are welcome to use if you wish). We expect you to create helper functions to create a clean and maintainable solution.

Your examples/tests will be graded separately from your code, with those points counting towards the "testing" theme of the course. We’re looking to see a set of tests that reflect "interesting" cases of the data (that would catch possible typos, boundaries, etc).

Remember to include the collaboration statement.

If you want to check whether your file has the same names as our grading scripts will look for, insert the appropriate check block at the bottom of your file (you do NOT need to satisfy the check block for the problem set that you did not do).

  # for the todo assignment:

  check:

    is-function(add-item) is true

    is-function(finish-item) is true

    is-function(overdue) is true

  end

  

  # for the flights assignment:

  check:

    is-function(is-valid-route) is true

    is-function(find-route) is true

  end

  

What/how to turn in

Create a directory named data-hwk. Inside the directory, put a single Pyret file named data.arr and either todo.arr or flights.arr, depending on which set of problems you did. Submit a zip of the data-hwk directory.

Make sure you follow these directory and file names exactly, or we won’t be able to grade your work.