CS 1101 - Cterm 10

Homework 6 - Writing functions for Lists of Structs

Due: Tuesday, February 9 at 5pm

Read the expectations on homework.

Assignment Goals


The Assignment

Using the data definitions you developed in Homework 5, develop the following functions. Make sure you follow the templates (i.e. you should be developing helper functions!)

(A set of solutions to Homework 5 will be published after the late submission date for HW5 has passed (5pm Saturday). You are welcome to use any of the definitions from this solution as your starting point for Homework 6).

  1. Because of the economic recession, people are not willing to donate as much to charity as they normally would. Write a function reduce-donations that consumes a list of agencies and produces a list of agencies. The list that is produced is the same as the original, except the amount of the donation for each agency in the list has been reduced by 10%.

  2. Write a function number-with-donors that consumes a list of agencies and produces the number of agencies that have at least one donor on their donor list.

  3. Write a function total-donations that consumes a list of agencies and produces the total amount of all donations pledged to all agencies in the list.

What to Turn In

Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Follow the naming conventions for naming your file.