On this page:
The Problem
Methods that effect a simple state change.
Methods that change the state of structured data.
8.5

Lab 8: Understanding Mutation

Goals: The goals of this lab are to learn how to design methods that change the state of on object or a state of a data structure, as well as how to design tests that verify the effects of such methods.

Submission: Submit your code for all of the problems below in handins by the end of your lab period. You should work with your partner on this, but you will make individual submissions. You can submit a zip file in handins to submit all of the Banking files. To get full credit, your code must make a good attempt at the problems below and be well-designed. Templates are not required, but recommended.

To understand mutation we need to learn how to:

Related files:
  Banking.zip  

The Problem

For this lab we will work with bank accounts. For our purposes we have three types of accounts:

The bank has a list of Accounts where a customer may deposit or withdraw money. A withdrawal from an account cannot reduce the balance below the minimum, and, for credit lines, cause the balance owed to be above the maximum limit. When a customer deposits money to an account, the balance increases, though for a credit line this decreases the amount owed, which cannot drop below zero.

Methods that effect a simple state change.

Start a new project named Banking and import into it the files from the Banking.zip file above.

Methods that change the state of structured data.

The Bank class keeps track of all accounts.