Alice is going to create a notebook including the profile of all her friends. For each...

60.1K

Verified Solution

Question

Programming

Alice is going to create a notebook including the profile of allher friends. For each of her friends, she would like to keepfirst-name, last-name, cell number, and birthdate (month and day).At the beginning, she doesn’t know how many spaces she shouldreserve for recording her friends, so she gradually inputs herfriends’ information into it. Please help her by first creating aJava class, called Person, with the required information fromdescription above, along with any required setter/getter methods.Then create, a Java class, called FriendsList, that keeps the listof some persons as someone’s friends, using the Person class above,and performs the required operations, such as add new friends,delete/ modify an existing one, return the list of her friendssorted by last-names, report the number of her friends, report thelist of her friends who born in a given month sorted by their dayof birth, and report the list of her friends who born in a givenday of a month, sorted by their last-names. She also needs to getthe cell number of a friend by giving her/his first-name andlast-name. Create a tester class, called MyFriends, to test theFriendList class by creating a new object of this class, addingsome friends, modifying and deleting some existing friends,retrieving and printing all friends, retrieving and printing thelist of friends who born in a given month, retrieving and printingthe list of friends who born in a given day of a month, and findingthe cell number of an existing friend by giving her/his first-nameand last-name. Also, create a separate copy of the FriendListobject you have already created, and remove all friends withfirst-name “Shane” from the new object.

Create a subclass of Person, called Employee, such that it cankeep extra information of a person including year of hiring, annualsalary, vacation days, and unused vacation days. Provide requiredsetter/getter methods for this class. Create a subclass ofEmployee, called Manager, which also has monthly bonus, and thelist of all her/his employees. Provide required setter/gettermethods for this class. Create a class, called Company, with thefollowing information: name of the company, starting year, and thelist of all its employees/managers. Provide required setter/gettermethods for this class. Create a tester class, called MyCompany, inwhich you should test all the above classes by creating a company,adding some employees/managers into it. Bonus: Provide two listingsof the company’s employees/managers, one sorted by last-names, andone sorted by each manager and then her/his employees.

Answer & Explanation Solved by verified expert
4.2 Ratings (537 Votes)
Hello dearPLEASE UPVOTE IF THIS ANSWER SEEMS HELPFUL AS IT GIVESTHE CONFIDENCE TO HELP MORE STUDENTSTHANKYOUHere is your code with commentsplease go through itPersonjavapublic class Person private String firstName private String lastName private String cellNumber private int birthMonth private int birthDay public Person firstName lastName cellNumber birthMonth 0 birthDay 0 public PersonString firstName String lastName String cellNumber int birthMonth int birthDay thisfirstName firstName thislastName lastName thiscellNumber cellNumber thisbirthMonth birthMonth thisbirthDay birthDay public String getFirstName return firstName public void setFirstNameString firstName thisfirstName firstName public String getLastName return lastName public void setLastNameString lastName thislastName lastName public String getCellNumber return cellNumber public void setCellNumberString cellNumber thiscellNumber cellNumber public int getBirthMonth return birthMonth public void setBirthMonthint birthMonth thisbirthMonth birthMonth public int getBirthDay return birthDay public void setBirthDayint birthDay thisbirthDay birthDay Override public String toString return Name firstName lastName Brithday getBirthMonth getBirthDay Cell number getCellNumber FriendsListjavaimport javautilArrayListimport javautilCollectionsimport javautilComparatorpublic class FriendsList private ArrayList friends public FriendsList friends new ArrayList public void addFriendPerson person friendsaddperson delete using first name last name birth month and day public void deleteFriendString firstName String lastName int month int day Person person null for Person p friends if pgetFirstNameequalsIgnoreCasefirstName pgetLastNameequalsIgnoreCaselastName pgetBirthMonth month pgetBirthDay day person p    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students