CSCI0050 Tables1 Assignment
CSCI0050 Homework: Programming with Tables

Due: Tuesday, July 10 at 6pm

Assignment Goals:
  • To practice writing programs over tables

Collaboration Policy: This is an individual assignment. Your work must be your own, though you can certainly utilize Kathi and Eli’s office hours for help.

Reminder: put the following lines at the top of your file to get all the needed table operations:

  include tables

  include shared-gdrive("table-functions.arr", "14jG4wvAMhjJue1-EmY-u9hX4UwmPHCO8")

  include gdrive-sheets

Exercises: The Ice Cream Menu

Put your work for this set of exercises in a file named icecream.arr. At the top of the file, confirm that you worked on your own by including this statement: "I understand this is an individual assignment, the work below is my own"

A local ice cream store stores information about its current flavors in a Google Sheet. It wants to use data from the sheet to generate the menu for its new digital menu board. Your job is to write the programs they need to generate content for the menu board.

Here’s the link to the Google sheet. Create a Pyret file for this assignment, and load this sheet as your initial table. We’ll refer to this as the flavors table in describing subsequent problems.

Loading a Table from Google Sheets: the following lines show you how to load the above table into Pyret:

  include gdrive-sheets

  

  # the long string below is the last part of the URL to the sheet

  flavors-sheet = load-spreadsheet("1drj1kiC3VVCe17wrrTpNUn0DSx9R0mhdNkan7znOdcE")

  

  flavor-data = load-table: name, core, add-in, base, style

    source: flavors-sheet.sheet-by-name("flavors", true)

  end

The Problems

Letter Grades, Revisited

Put your work for this set of exercises in a file named gradebook-hwk.arr. Include only the code needed for this assignment (not all of the code from your notes from this week). Confirm that you worked on your own by including this statement: "I understand this is an individual assignment, the work below is my own"

At the end of Thursday’s lecture, we were left with the following function (or one similar) to compute letter grades:

  fun grade-to-letter(r :: Row) -> String:

    doc: "produce a letter grade for a student"

    if r["avg"] >= 88: "A"

    else if (r["avg"] >= 76) and (r["avg"] < 88): "B"

    else if (r["avg"] >= 60) and (r["avg"] < 76): "C"

    else: "NC"

    end

  end

Grading and Expectations
What/how to turn in

Submit two files, icecream.arr and gradebook-hwk.arr, through this Google form.