Create an AddressBookException class that you can use to throw exceptions in your address book. Your class should have a constructor that will allow you to set the particular message that corresponds to the error. You should use your custom exception class to throw an error in the findPerson method if the person being searched for cannot be found, in the getPerson method if the AddressBook is empty. You should also throw an error any time that the addressbook file that you are attempting to read or write from cannot be opened. In main test your AddressBook exception class by placing a try - catch around any code that could possibly throw an error. Supply a catch block to catch the AddressBook exception and provide a catch all block just in case an exception is thrown the you may have missed.
CSIS211: Assignment 05 Exceptions
The coding method: C++
C++ coding assigment 5
I am having trouble getting my coding working because I addressBook.cpp and addressbook.h is not working well with my Person so I need help figure out the problem because I have don't know how to fix my coding so that both person and addressbook work for the main.
remainder: Please don't solve answer in Java because I never take Java and mostly take C++ classes. Please explain how solve this problem in C++. Make sure to type c++ in different files like Main.cpp, Person.cpp, Person.j, AddressBook.cpp, and AddressBook.h
This small project is geared to test your understanding of File IO.
AddressBook Exception
Create an AddressBookException class that you can use to throw exceptions in your address book. Your class should have a constructor that will allow you to set the particular message that corresponds to the error.
You should use your custom exception class to throw an error in the findPerson method if the person being searched for cannot be found, in the getPerson method if the AddressBook is empty. You should also throw an error any time that the addressbook file that you are attempting to read or write from cannot be opened.
In main test your AddressBook exception class by placing a try - catch around any code that could possibly throw an error. Supply a catch block to catch the AddressBook exception and provide a catch all block just in case an exception is thrown the you may have missed.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images