Closed

Java simulation of mobile telephone phonebook

This project was awarded to Hercsoft for $68 USD.

Get free quotes for a project like this
Project Budget
$30 - $100 USD
Total Bids
1
Project Description

Produce a Java simulation of a mobile telephone’s phonebook. The

supplied Java interface class (Appendix: [url removed, login to view]) shows the suggested contract between the class

implementing the interface and any client classes. This interface must be used unmodified, however the class that

implements it may provide additional methods.

## Deliverables

produce a Java simulation of a mobile telephone’s phonebook. The

supplied Java interface class (Appendix: [url removed, login to view]) shows the suggested contract between the class

implementing the interface and any client classes. This interface must be used unmodified, however the class that

implements it may provide additional methods. Your design should satisfy the following requirements:

• Phonebook facilities

The phonebook has a limited capacity (eg 30), and once this is reached no new entries may be added unless an

existing entry is deleted. Each entry consists of a name and a number. When adding a new entry, the name and

number are entered as strings. Names in phonebook entries must be unique (no duplicates). There are three

basic “search?? functions:

- getNumber(name) returns the number corresponding to a given name

- getEntry(name) returns the matching entry as a string “name..number??

- removeEntry(name) finds and removes the entry for that name (if any)

Further functionality is achieved by using ListIterator objects, which provide the methods next(),

hasNext(), previous(), hasPrevious(), set(object), add(object), and remove(). Note that

when iterating through the phonebook, entries should be retrieved in alphabetical order, and displayed in the form

“name..number??.

• The application

For testing purposes the application could offer a simple text menu like the following:

0. Exit

1. Add a new entry

2. Locate an entry

3. Remove an entry

4. Find a number

5. List all entries

6. Clear all entries

7. Browse...

The Browse submenu tests iterator methods, and could look something like this:

0. Return

1. First entry

2. Next entry

3. Previous entry

4. Last entry

5. Remove

6. Edit...

The Edit option is used to replace the current entry; but as this might disturb the alphabetical ordering the submenu

should return to the main menu after the Edit is completed.

What I need:

You must design, implement, test and document adequately the phonebook application, in two phases:

Phase one: you need to draw a UML class diagram with association for the application and implement the Abstract Data Type classes:

1. An Entry class that implements Comparable represents phonebook entry. In addition to the methods

that you think are necessary, the class should have:

i) a constructor method Entry(String name, String number) to initialize the attributes name,

number

ii) compareTo(Entry other)method which compares this entry with other entry for order based on

name. The method returns int for the result of comparison.

iii) equals(Object entry) method which override the default equals() based on attributes equality.

The method returns true if both name and number match, else false.

iv) toString() method to return a string of the form “name..number??.

2. A MyPhoneBook class implements the PhoneBook interface. The implementation should comply with the

interface specification however you may provide addition methods. (Hint ??" as the menu options indicate)

You may use any Java collection class you like (eg ArrayList, LinkedList, HashSet, TreeMap), or

use an ordinary array, or create your own data structure from scratch if you prefer. If you write your own

search or sort algorithm then this should be documented in pseudocode. Obviously, by using the “right??

library classes you will have much less work to do.

3. A PhoneBookTest class tests the phonebook operations using hard-coded test data non-interactively.

You will need to produce a test plan to test all operations. You should aim to demonstrate all methods

defined in the Entry class and then the methods in MyPhoneBook that corresponds to the menu options.

Ensure your program is working correctly at this point. Print your test code listing and the original output

script produced for evidence.

Phase two: you need to improve the design by using the MVC pattern to provide a text based menu driven

interface which enables a user to interact with the application. All input should be via the keyboard. This

requires you to create additional classes:

4. a PhoneBkIO class that displays menus and handles all input and output

5. a PhoneBkController class that controls interactions between user and the program

6. a PhoneBkPro class that defines one method only ??" the main() method, which should be very short, say

two lines only, to run the application interactively.

Appendix: Listing of the PhoneBook interface

/**

* Interface for a simple phonebook class, which could be used

* as part of a mobile phone or PDA application.

* @author 210CT Tutor

* @version 1.2, June'10

*/

public interface PhoneBook

{

/**

* Add an entry to the phonebook, provided it's not full

* and the person's name is not already there

* @param name the person's name to add

* @param number that person's phone number

* @return true if successful, else false

*/

public boolean addEntry(String name, String number);

/**

* Given a name, retrieve the phonebook entry as a string

* (or return null if there is no matching entry)

* @param name the person's name to look up

* @return the entry in the form "Hong..02476887751" (or null)

*/

public String getEntry(String name);

/**

* Remove the phonebook entry matching a given name

* @param name the person's name to remove

* @return true if successful, else false (no match)

*/

public boolean removeEntry(String name);

/**

* Retrieve the number corresponding to a given name

* @param name the person's name to look up

* @return that person's phone number (null if no match)

*/

public String getNumber(String name);

/**

* Get current size of phonebook (number of entries)

* @return number of entries currently held

*/

public int size();

/**

* Check if phonebook is empty

* @return true if empty, else false

*/

public boolean isEmpty();

/**

* Check if phonebook is full

* @return true if full, else false

*/

public boolean isFull();

/**

* Remove all entries from the phonebook

*/

public void clear();

/**

* Create an iterator object that implements ListIterator, ie with

* next(), hasNext(), previous(), hasPrevious(), set(), add(), remove()

* @return a ListIterator object

*/

public [url removed, login to view] iterator();

/**

* Concatenate all entries into a single string, with newlines after

* each entry, eg "Alkis..02476888377\nHong..02476887751\n..."

* @return a string containing all phonebook entries as above

*/

public String toString();

}

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online