Quick Index
Introduction


Video


Here is a video that goes along with this page.

Overview


A drill to increase experience in using method menus.

Objectives



Prerequisites


For reference while doing drills:


Rules



Requirements


The requirements for this drill are:


Deliverables


Your deliverables for this drill:


Provided Code


In this zip file you will find the starter file "method-menus-drill.txt":


Notes on Problems



Drill Problems



In this problem the roofing company is estimating total cost of the roofing project.

Given:

LabelDimension 1Dimension 2
Gymnasium Roof400200
Auditorium Roof300300

Instructions:
  • Construct objects using the three attributes for each roof
  • Compute the total area
  • The estimated cost of the roofing project is equal to: total area * 2.50
  • Print out the total area
  • Print out the total estimated cost

Hint - The roofs are rectangular
Instructions:
  • Construct a list of Mathematician objects
  • Print out nice display string of each item in the list

Hint - You may call a method that generates the list for you (if one is available).
Given:
First
Name
Last
Name
CountryGenderKnown For
IsabelHubardMexicoFSymmetries of Combinatorial Objects

Instructions:
  • Construct the relevant object for the given data
  • Print out only the last name, gender, and knownFor
In hydraulics (flow) the hydraulic radius (r) is a factor that determines the capacity of a channel.

A higher r value means more flow in the channel. This means that two channels may have the same cross sectional area, but one will be more efficient (per higher r).

r = area / perimeter

Given:
Channel
Label
Channel
Width
Channel
Depth
Channel #11010
Channel #21001

Instructions:
  • Construct objects for the given data
  • Print out the objects
  • Print out the label (derived from the objects) of the object that yields more flow in the channel (higher r)
  • You may use divide (/) operators in this problem

Hint - The channel is rectangular
Given:
Boundary
Left
Boundary
Top
Boundary
Width
Boundary
Height
-3.1211.113.726.26

Instructions:
  • Construct a Rectangle to represent the given boundary data
  • Generate a list using the City newSampleSet1() method
  • Iterate through the list of cities
  • For each city print out a nice display string, and whether or not (true/false) the given city is inside the boundary

Fun Fact: The boundary above is an rectangular approximation of Ghana.
Given:
CityCountryLatitudeLongitude
MinneapolisU.S.44.977753-93.265015
AccraGhana5.6037-0.1870

Instructions:
  • Construct City objects from the given data
  • Compute the distance between the cities (by using various methods in the method menus)
  • Print out the distance

Hint - See highlighted message at top of GeoLocation method menu (and note the ivar location on City).
Given:
CityCountryLatitudeLongitude
AccraGhana5.6037-0.1870
CairoEgypt30.056131.2394

Instructions:
  • Construct City objects from the given data
  • Compute the distance between the cities (by using various methods in the method menus)
  • Print out the distance

Hint - See highlighted message at top of GeoLocation method menu (and note the ivar location on City).