Overview Schedule Announcements Resources Assignments Home

CSC 121: Computer Science I, Spring 2005

Lab 10

Laboratory 10 - Pattern Recognition: 2-D Arrays, Project 4

Goals:
To prepare for project 4: Working with 2-D arrays.
Getting started:
The Steps of the Lab:
  1. Open the rainfall project.
    Do

    This project has one class, Rain. When you open the class in the class editor, you will see that a 2-D array called rainData has been defined and initialized. Each entry in the array contains a double that represents the amount of rain in inches that fell on that day. Flex your 2-D array muscles by writing the following methods:

    • Write a method called totalRainfall that returns the total amount of rainfall (in inches) for the entire time period.
    • Write a method called dryDays that returns the number of dry days (days with no rain).
    • Write a method called averageRainfall that returns the average rainfall over all days.
    • Write a method called weekendRain that returns the number of weekend days which had some rain.
    • Write a method called washouts that returns the number of "washout weekends" - this is the number of weekends in which it rained on both Saturday and Sunday.
    • Write a method called dryWeeks that returns the number of dry weeks - this is the number of weeks in which there was no rain all week.
Overview Schedule Announcements Resources Assignments Home

Valid HTML 4.01!Valid CSS!DePauw University , Computer Science Department , Spring 2005
Maintained by Brian Howard ( bhoward@depauw.edu ). Last updated