Question: 1. Create a class named Contact with the following attributes: First name, Middle name, Last name, Date of birth, Gender, Anniversary, Address, Area, City,
1. Create a class named Contact with the following attributes: First name, Middle name, Last name, Date of birth, Gender, Anniversary, Address, Area, City, Pincode, State, Country, Telephone number, Mobile number, Email, Website. (Contact.java) 2. Write a method named validate() in the Contact class created earlier. This method must generate an exception if any of the following validation rules fail: i. First name, last name, date of birth and email are compulsory. ii. E-mail must be in the correct format, display correct format. iii. At least one of either telephone or mobile number must be specified Note: Do not use Predefine collection classes (API) while implementing 3. Implement stack for Contact objects. Use exception handling to apply the following rules: i. ii. iii. A pop must fail on an uninitialized stack and empty stack A push must fail on an uninitialized stack and stack which is already full A push must fail on a stack if the Contact object's validation fails.
Step by Step Solution
There are 3 Steps involved in it
1 Contactjava class Contact String firstName String ... View full answer
Get step-by-step solutions from verified subject matter experts
