Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, need help making these two Classes to my class GUI, which will use these two Classes. To look for people, add people, remove people,

Hi, need help making these two Classes to my class GUI, which will use these two Classes. To look for people, add people, remove people, load the phone book from the file PhoneList.txt, and save it to a file with a name should all be made possible by this class. PhoneList.txt is notepad list that looks like below

Noah Smith 10001 Emma Jones 10002

etc..

The Picture below is the instruction for making the two classes.

image text in transcribed

image text in transcribed

Each person has one givenName, one surname, and one phone number. The instance variables are initialized with the constructor arguments. The three get.. methods return the surname, the full name (given name and surname separated by space) and the phone number. Each line from the external file "PhoneList" defines one instance of Person. The persons are managed by an instance of PhoneBook, which stores all persons in a dynamic array and provides methods to manage them. listOfNumbers stores all instances of Person that are listed in the phone book. It is initialized in the constructor. load (arg) opens the file named arg, cre- search(arg) checks if listOfNumbers contains persons specified by arg. arg can be the surname or the phone number. We create a dynamic array in the search method, add to it all the persons we found (several persons can have the same surname) and return it. deletePerson (arg1, arg2) deletes a person that has the full name arg1 and the phone number arg2 (both must be given and match those of the person). You can use search(arg) with the phone number arg and compare the name of the returned person with arg1. The method returns either "The personumber does not exist" or "Person deleted". addPerson(arg1, arg2 ) adds a person with the full name arg1 and the phone number arg2. The person is not added if a person with that phone number already exists or if arg1 does not contain exactly two words. It returns the boolean true if the person could be added and false if it could not be added. save (arg) saves all persons in listOfNumbers in the external file named arg in the same format as PhoneList. Catch IO errors in this method. The full name is saved in a column of width 20 and the phone number in a column of width 5. save(arg) should return the string "Saved " + listOfNumbers.size ()+ " people to the file." if the saving succeeded. If the saving failed it should return the string "Could not save to the file

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

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

1. Signs and symbols of the map Briefly by box ?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago