Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Ec2 ahd02 problem_statement
1. MyShaadi, a well known online matrimonial site wants to computerize its operations. Define the classes as shown in
the class diagram below. Include getters and setters for each attribute of all classes.
Person class contains the generic data for both bride and groom. Both Bride and Groom class extends Person class
and adds respective attributes. Object of Bride can be created by passing name, age, cast and cookingSkills. Object of
Groom can be created by passing name, age, cast and income.
MyShaadi is a public class containing list of brides and grooms.
2. The following are the names of attributes along with getters and setters. Implement these methods in respective
classes.
Class Attributes Getters Setters
Person name getName() setName()
age getAge() setAge()
cast getCast() setCast()
hobbies getHobbies() setHobbies()
Groom income getIncome() setIncome()
Bride cookingSkills getCookingSkills() setCookingSkills()
MyShaadi brides getBrides() setBrides()
grooms getGrooms() setGrooms()
Implement the following behaviors in given classes.
Note : While checking contents of two String for equality, their case should be igored.
• Person
1. addHobby(String s) : int
– This behavior takes String object as a input and adds it to the hobbies list. If a hobby already exists with
same value, it shouldn't add it to the list. This behavior returns no of hobbies as return value in
successful addition otherwise -1.
• MyShaadi
1. registerBride(Bride brideObj) : int
– This behavior takes Bride object as input and adds it to the Brides list. It returns the total no of brides
registered in MyShaadi. If the list already contains a bride with same name, age and cast, it should not
be added into the list and return value should be -1.
2. registerGroom(Groom groomObj) : int
– This behavior takes Groom object as input and adds it to the Grooms list. It returns the total no of
grooms registered in MyShaadi. If the list already contains a groom with same name, age and cast, it
should not be added into the list and return value should be -1.
3. searchForBride(Groom groomObj, boolean cookingPref, String hobby) : int
– This behavior takes Groom object as input and searches in brides list. The search should be done on
given conditions and return the count of brides which are matching the given criteria. It should return -1
in case of no result found.
– Age of the bride should be atleast 1 year less and atmost 3 years less than the age of groom.
– Cast of bride should be same as cast of groom.
– Cooking preference should be checked.
– Input argument hobby should be there as one of the hobby of the bride.
4. getTotalGrooms(double income,String hobby) : int
This behavior takes income and hobby as input and searches in the grooms list. It should return total
3. number of grooms whose income is greater than or equal to the income specified and who also contains the
hobby specified as the argument. It should return -1 in case of no results found.