Skip to main content

Homework 2

Skills: 0, 1, 11

Due

Sunday, Sept 27, Anywhere-on-earth

Submission

This HW, like all homeworks, is done on https://github.com and submitted on https://app.pawtograder.com. Go to Pawtograder to find the repository where the assignment should be done. Commits automatically make submissions.

While there may be automated feedback for parts of the "Programming Practice" section, ALL OF YOUR GRADE IS DETERMINED BY THE ASSIGNMENT CHAT THAT OCCURS DURING THE LAB FOLLOWING THE DEADLINE (see Assignment Chats).


Project

Project 1: Data Analysis

Your first (of three) open-ended course projects begins this week. Like other homework, projects will be graded by assignment chats during lab (see Assignment Chats). Since projects are large, each week there will be checkpoints due, which are a part of the project. Also, since you won't finish the project this week, it will exist in a separate repository from your Homework 2 repository, and therefore there is a separate assignment on Pawtograder for Project 1. It has the due date when project is due, but each week there is a checkpoint for the project that should be completed by Sunday night.

This project gives you the following task:

Find a publicly available data set that is available in CSV (comma separated value) format, and come up with three questions that can be answered via standard plots (histogram, scatter plot, etc -- see Plots & Charts). These questions should be interesting to you.

Project 1, Checkpoint 1, due this week, is:

  • Find a publicly available data set, and come up with one question you think might be answerable via a plot. Write down what you think you might find when you plot the data. NOTE: you do not need to write any code for this checkpoint -- just the source of the data, what it contains, what your question is, and what you think you might find.

Programming Practice

Consider that we can use a number to represent seconds in a minute: any whole number from 0 to 59 (inclusive) is valid, but numbers above or below (or fractions or decimals) are not valid.

Problem 1

Design a function, tick, that takes a number of seconds and returns the next second, as if a clock were ticking. Be sure that it does the right thing if given 59 seconds as input! Be sure to include a doc: string and test cases in a where: block!

Problem 2

Design a function seconds-to-image that, given a number of seconds (a number between 0 and 59), produces an image of a timer with the seconds hand at the appropriate place -- i.e., an analog clock face with just a second hand. It's up to you how you would like it to look, but one way could be:

Timer image example

It's also not required for the hand to only extend from one side. i.e., it would be fine if your timer looked like this (for 15 & 45):

Timer image example

You do not need to provide any markings or numbers on the timer face, or to include test cases, but you should include a doc: string.

Problem 3

You're designing a conference registration system, and one component of that is taking registration data and using it to construct conference badges that will be printed out for attendees to wear.

Please implement the following function, which should create an image of a Badge. NOTE: you do not need to write test cases for this function, but please run it a few times in the interactions window to make sure the output looks good.

fun print-conference-badge(name :: String, gender :: String, email :: String, nuid :: String) -> Image:
doc: "prints a conference attendee badge"
# ...
end

Problem 4

According to the contextual integrity framework, privacy involves maintaining "appropriate flows of information in a particular context." Here is a filled-out analysis of the flows of badge information in the context of the conference:

What type of information is shared?Personal information: name, gender, email, NUID
Who is the subject of the information on each badge?The conference attendee wearing the badge
Who is the sender of the information?The conference organizers
Who are the potential recipients of the information?Intended recipients:
All conference attendees, sponsors, and co-organizers

Unintended recipients:
Other people in the building
Other people on the street if attendees forget to take off their badge
Other people who have access to the information database such as future conference organizers
What principles govern the collection and transmission of this information?Collection is mandatory for all conference attendees and they consent to giving us this information in order to attend.

The principle of data minimization suggests that we limit the collection, storage, and transmission of personal data to only the data absolutely necessary to perform the task.

Using our privacy analysis above, identify one of the four pieces of information that we currently collect (name, gender, email, NUID) that isn’t absolutely necessary to share with all of the potential recipients at a conference. Explain in 1-2 sentences why removing this piece of information from the badge would be beneficial to preserve privacy.

Problem 5

Create a new function, print-conference-badge-minimal, that reflects your decision in Problem 4, only accepting the necessary information and creating an image of a badge with it. As with Problem 3, you do not need to write test cases for this function.