Question: Here is a specification for a class MyPhonebook. Use this for the problem that follow. The operations are all public. Draw a State Chart Diagram

Here is a specification for a class MyPhonebook. Use this for the problem that follow. The operations are all public.
Draw a State Chart Diagram describing the interaction protocol of MyPhoneBook
Here is a specification for a class MyPhonebook. Use this for the problems that follow. The operations are all public.
```
MyPhoneBook();// constructor
// postcondition: getSize()==0
~MyPhoneBook();// destructor
void add (string name, unsigned number);
// precondition: (name !=0) AND (name !="") and (number !=0)
// postcondition: If (lookupNumber(name)==0) AND (lookupName(number)==""), then
(the pair (name, number) are added to the phonebook)
AND (the existing phonebook entries are unchanged) AND (getSize()+1== getSize()')
void remove (string name);
// postcondition: If (lookupNumber(name)!=0) then
(the pair (name, lookupNumber(name)) is removed from the phonebook)
AND (the remaining phonebook entries are unchanged) AND (getSize()'== getSize()-1)
void remove (unsigned number);
// postcondition: (the phonebook entries are unchanged) AND (getSize()'== getSize())
unsigned lookupNumber (string name);
// postcondition: If name| exists in the phonebook, then return its associated number. The
phonebook entries are unchanged AND (getSize()'== getSize())
string lookupName (unsigned number);
// postcondition: Return "". The phonebook entries are unchanged AND (getSize()'== getSize())
int getSize();
// postcondition: (getSize()'== getSize()) AND (the phonebook entries are unchanged)
```
Here is a specification for a class MyPhonebook.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!