Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a detailed class diagram which shows all of your proposed classes (for which you will instantiate objects). For each class, specify the attributes and

Develop a detailed class diagram which shows all of your proposed classes (for which you will instantiate objects). For each class, specify the attributes and operations that will be required to meet all of the functional requirements.

Requirements Statement

The software to be designed is a program that can be used to maintain an address book. An address book holds a collection of entries, each recording a person's first and last names, address, city, state, zip, and phone number.

It must be possible to add a new person to an address book, to edit existing information about a person (except the person's name), and to delete a person. It must be possible to sort the entries in the address book alphabetically by last name (with ties broken by first name if necessary), or by ZIP code (with ties broken by name if necessary). It must be possible to print out all the entries in the address book in "mailing label" format.

It must be possible to create a new address book, to open a disk file containing an existing address book to close an address book, and to save an address book to a disk file, using standard New, Open, Close, Save and Save As ... File menu options. The program's File menu will also have a Quit option to allow closing all open address books and terminating the program.

The initial requirements call for the program to only be able to work with a single address book at a time; therefore, if the user chooses the New or Open menu option, any current address book will be closed before creating/opening a new one.

The program will keep track of whether any changes have been made to an address book since it was last saved, and will offer the user the opportunity to save changes when an address book is closed either explicitly or as a result of choosing to create/open another or to quit the program.

The program will keep track of the file that the current address book was read from or most recently saved to and will use that file when executing the Save option. When a New address book is initially created, its name will be titled "Untitled", and a Save operation will be converted to Save As ... - i.e. the user will be required to specify a file.

Use Cases for a Simple Address Book

In the following, use cases are listed in the natural order that a user would think of them. In the actual File menu, items that correspond to the various use cases will be listed in the traditional order, which is slightly different.

image text in transcribed

Flows of Events for Individual Use Cases

Add a Person Use Case

The Add a Person use case is initiated when the user selects "Add" in the main menu. A message appears, with title "New Person" and then prompts the user to the new person's first and last names and other information. If the "OK" option is selected, a new person is added to the end of the address book. If the "Cancel" button is clicked, no changes are made either to the address book or to the main window.

Edit a Person Use Case

The Edit a Person use case is initiated when the user enters a record number after selecting the "Edit" function. The user is presented with options to change any of the fields in the user record. The operation can be dismissed by selecting either "OK", or "Cancel". If "OK" is selected, the entry in the address book for the selected person is updated to reflect any changes made by the user. If the "Cancel" button is clicked, no changes are made to the address book.

Delete a Person Use Case

The Delete a Person use case is initiated when the user selects a record number after selecting the "Delete" function. A prompt appears, asking the user to confirm deleting this particular individual. If "OK" button is selected, the entry in the address book for the selected person is deleted, and the person's name is deleted from the list of names in the main window. If the "Cancel" option is selected, no changes are made either to the address book or to the main window.

Sort Entries by Name Use Case

The Sort Entries by Name use case is initiated when the user selects the Sort by Name option. The entries in the address book are sorted alphabetically by name, and listed on the screen.

Sort Entries by ZIP Use Case

The Sort Entries by ZIP use case is initiated when the user selects the Sort by ZIP option. The entries in the address book are sorted by zip code and listed on the screen.

Print Entries Use Case

The Print Entries use case is initiated when the user chooses "Print" from the menu. A save file prompt is displayed, and the user is allowed to choose a file to print the labels to. (If the user cancels the file dialog, the Print operation is canceled.) The current contents of the address book are written out to the specified file (in their current order) in "mailing label" format. No information maintained by the program is changed.

Create New Address Book Use Case

The Create a New Address Book use case is initiated when the user chooses "New" from the File menu. If the current address book contents have been changed since the last successful New, Open, Save, or Save As ... operation was done, the Offer to Save Changes extension is executed. Unless the user cancels the operation, a new empty address book is then created and replaces the current address book.

Open Existing Address Book Use Case

The Open Existing Address Book use case is initiated when the user chooses "Open" from the File menu. If the current address book contents have been changed since the last successful New, Open, Save, or Save As ... operation was done, the Offer to Save Changes extension is executed. Unless the user cancels the operation, a load file dialog is displayed and the user is allowed to enter a file to open. Once the user enters a filename, the current address book is replaced by the result of reading in the specified address book. (If the user cancels the file dialog, or attempting to read the file results in an error, the current address book is left unchanged. If the cancellation results from an error reading the file, a message is displayed warning the user of the error.)

Save Address Book Use Case

The Save Address Book use case is initiated when the user chooses "Save" from the menu. If there is a current file, the current address book is saved to this file. (If attempting to write the file results in an error, a dialog box is displayed warning the user of the error.) If there is no current file, the Save Address Book As .. use case is done instead.

Save Address Book As ... Use Case

The Save Address Book As ... use case is initiated when the user chooses "Save As ..." from the menu. (The Save As ... option is always available.) A save file dialog is displayed and the user is allowed to choose the name of a file in which to save the address book. (If the user cancels the file dialog, the Save As ... operation is canceled.) The current address book is saved to the specified file, and the file to which it was saved becomes the current file. (If attempting to write the file results in an error, a dialog is displayed warning the user of the error, and the current file and main window title are unchanged.) In all cases, the current address book and window list are left unchanged.

Quit Program Use Case

The Quit Program use case is initiated when the user chooses "Quit" from the menu. If the current address book contents have been changed since the last New, Open, Save, or Save As ... operation was done, the Offer to Save Changes extension is executed. Unless the user cancels the operation, the program is terminated.

Offer to Save Changes Extension

The Offer to Save Changes extension is initiated from within the Create New Address Book, Open Existing Address Book, or Quit program use cases, if the current address book has been changed since the last successful New, Open, Save, or Save As ... operation was done. A message is displayed, informing the user that there are unsaved changes, and asking the user whether to save changes, not save changes, or cancel the operation. If the user chooses to save changes, the Save Address Book Use Case is executed (which may result in executing the Save Address Book As ... Use Case if there is no current file). If the user chooses not to save changes, the original operation is simply resumed. If the user chooses to cancel (or cancels the save file dialog if one is needed), the original operation is canceled.

Analysis

An initial reading of the use cases suggests that the following will be part of the system.

A single entity object representing the current address book that the program is working with (AddressBook).

An arbitrary number of entity objects, each representing one of the people that is in the current address book (Person).

A boundary object representing the interface between the address book system and the human user (AddressBookUI).

A boundary object representing the interface between the address book system and the file system on disk (FileSystem).

A controller object that carries out the use cases in response to user inputs on the UI (AddressBookController). (For a problem of this small size, a single controller is sufficient.)

image text in transcribed

User Address Book Application Add a Person Edit a Person Delete a Person Sort Entries by Name Sort Entries by ZIP Print Entries Create New Address Book extend extend en Existing Address Boo Op Offer to Save Changes Save Address Book include. include C Save Address Book As extend Quit Program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions