Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please help me to solve this java program Add a new exception to an existing system Create an Eclipse Project called JavaProgram .

can you please help me to solve this java program

image text in transcribed

Add a new exception to an existing system Create an Eclipse Project called JavaProgram . Import the com.raeside.family and com.raeside.exceptions packages into this project this system is meant to ensure that all members added to a family have the same surname and that no two people in the same family can share a first name; this should be accomplished using exception handling. Currently the system works for the first name exception but not for the surname exception (your job is to fix this so that both exceptions are handled). Run and test this program (run the MakeFamilyRobinson class). Add a new exception class to the existing system called SurnameMismatchException. Add some meaningful message to the exception e.g. "You must have surname Robinson to join this family". Declare the addFamilyMember0 method to throw SurnameMismatchException as well as the FirstNameExistsException. You will need to use the correctFamilyName( method to check that the Person being added to the Family has the correct surname, throw the new SurnameMismatchException from the addFamilyMember method (the addFamilyMember method already throws an exception but it is possible to throw more than one exception from the same method using comma to separate each exception thrown). Finally HANDLE the SurnameMismatchException exception in the MakeFamilyRobinson class in addition to handling the FirstNameExistsException when attempting to add a family new member using the MakeFamilyRobinson class. Test the new exception class is working by attempting to add a Person called "Jessy James" to the Robinson family (i.e. the correct SurnameMismatchException should be thrown, note: the FirstNameExistsException should still work if the first name of the Person being added is already in use in the family, but only one of the exceptions will be thrown at any one time). Test the FirstNameExistsException still works by attempting to add another new Person to the family whose first name would be the same as an existing family member but that has the correct surname, e.g., "Paul Robinson" (where there is a Paul already in the family). Required activities and marking guideline: - Create new custom exception SurnameMismatchException - Add new throw to addFamilyMember method (surname) - Add logic to throw the SurnameMismatchException exception - Create a new Person object and add to the family to test the addition of a member without correct family name - Create a new Person object and add Test the attempted addition of a family member with a first name that is already in use

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

More Books

Students also viewed these Databases questions

Question

Find y'. y= |x + X (x) (x) X 1 02x+ 2x 1 O 2x + 1/3 Ex 2x +

Answered: 1 week ago