Computer Science 210
Data Structures

Fall 2016, Siena College

Lecture 05: Classes
Date: Friday, September 16, 2016


Agenda

Lecture 05 Assignment

Due at the start of class, Monday, September 19.

Please submit answers to these questions by the start of class. zyBook activities should be done right in your zyBook, and all others should be submitted to Blackboard under "Lecture 05 Assignment" . We will discuss these questions at the start of class, so no late submissions can be accepted.

  1. Write a new mutator method for the Ratio class in the Ratios example that takes an int parameter and multiplies the value of the ratio by that number. Recall that you can multiply the value of a ratio by a value by multiplying its numerator by that number. Do not worry about reducing to lowest terms or any other simplifications. (5 points)
  2. Write a new mutator method for the Ratio class in the Ratios example that takes a Ratio parameter and multiplies the value of this ratio (the one whose method you are executing) by that ratio (the one you received as a parameter). Recall that you can multiply a ratio by another by multiplying their numerators to find the new numerator, and their denominators to find the new denominator. (5 points)
  3. Complete Challenge Activity 9.2.2 in J+DS zyBook. (4 points)
  4. Complete Challenge Activity 9.5.1 in J+DS zyBook. (4 points)

Terminology

Examples