CS 106 Winter 2016

Assignment 01: Input and output


Question 1 Haiku



A haiku is a three-line poem consisting of a line of five syllables, a line of seven syllables, and a line of five syllables. You will write a sketch that displays randomly generated haikus, based on text from two external data files, containing five-syllable and seven-syllable lines of text.

To begin, download one (or more) of the following ZIP files, containing input data for the sketch:

Each ZIP file contains the files fives.txt and sevens.txt. Create a new sketch called Haiku and add those two files to it.

Now write a sketch that does the following:

Tips

Question 2 Arcs



Download the SVG files arcs1.svg and arcs2.svg, containing two orientations of a simple arrangement of two quarter-circles. Each SVG file has size 50×50.

Now write a sketch called Arcs that draws a grid of these two tiles. Each cell in the grid can contain either of the two tiles; it's up to you to decide which one, according to any rule you want. At a minimum, you must have the following:

Tips

Enhancements

This question has no required enhancements, but you are welcome to experiment with interesting patterns of tiles, to add transitions to new patterns when the user presses a key, or even to modify the two tiles (as long as they still form unbroken designs across their edges). If you make any interesting enhancements, be sure to add a comment explaining them to the top of your sketch. Any especially interesting enhancements may receive bonus marks.

Question 3 Bar chart



Download the file BarChart.zip, containing a starter sketch for this question. The starter code reads a file oilprices.txt, containing the daily price in US dollars for a barrel of crude oil in November and December 2015, excluding weekends. Two weekdays don't have prices: US Thanksgiving and Christmas.

Now add the following functionality to the sketch:

Enhancements

This question has no required enhancements. But there are many obvious ways to improve the presentation of these data. Consider adding insets around the bar chart (in which case you don't need to fill the whole window), adding axes, lines and labels for prices, a title for the chart, and the other bells and whistles that make charts easier to read. If you make any interesting enhancements, be sure to add a comment explaining them to the top of your sketch. Any especially interesting enhancements may receive bonus marks.

Submission

Remember to review the Code Style Guide and use Processing's built-in auto format tool. Then review the How To Submit document. At the top of all of your source files, be sure to include a comment with your name and student ID number. When you're ready, zip all the sketches created above (Haiku, Arcs, and BarChart) into a single archive called A01.zip and upload that file to LEARN.