A Customer Care call center in Berlin processes Customer information.
A program needs to be designed to manage Customer information.
It has been decided to use Object Oriented Programming in the design of the program and take advantage of
Many classes need to be designed in this project. One advantage of OOP and encapsulation is that different programmers can work on different classes - classes can be designed and tested .
Program designers produce UML diagrams describing the properties/attributes of the class and the methods/behavoiur of the class.
Here is the UML diagram describing the Customer class.
| Customer |
|---|
| - name : String |
| - address : String |
| - phone : String |
| + Customer() //constructor method has no return type |
| + getName() : String |
| + getAddress() : String |
| + getPhone() : String |
| + setName(String) : void |
| + setAddress(String) : void |
| + setPhone(String) : void |
UML - Unified Modeling Language - diagrams can help software engineers to plan and visualise design ideas.
Points to note:
| Bucket |
|---|
| - maxVol : int |
| - currentVol : int |
| - isFull : boolean |
| + Bucket(int) //constructor method has no return type |
| + getMaxVol() : int |
| + getCurrentVol() : int |
| + getFull() : boolean |
| + setCurrentVol(int) : void |
| + toString() : String |
| + speak() : void |
A Bucket has:
When a Bucket is first constructed, maxVolume is set by a parameter, the current volume is set to zero and the indicator is set to false.
It has the following behaviour:
Use this information and the UML diagram above to design the Bucket class.
In another class, eg a Main class, construct 2 instances (or more) of the Bucket class (a Bucket object).
Write a program that will keep filling the Buckets until one of them is full. The buckets speak as it they are being filled.
Call the toString method of each Bucket instance at the end of the program.
Note: the toString method just returns a sentence containing the state of all instance variables.