HI this is my lab 4 exercise which is continue part of lab1,2,3 and assignment which you guys did for me this is continue parts I have few requests that kindly assign this to the same expert who did my previous labs as you this one continue part and secondly If there is any my details required please mentionSTUDENT NAME: AHMER NASIRSTUDENT ID: 6880101STUDENT EMAIL:
[email protected] submit assignment on time do not delay like last time all the instruction are mentioned in document thanks
DPIT121 – Lab Exercise 4 Due: Week 6 lab You already submitted phase one of your project delivery as assignment I. In lab 4, you will continue on another iteration focusing on copy constructor, interface, comparable, Cloneable, shallow copy, deep copy, and sorting the list of objects. Download and study lecture codes from week 4 ( 3 recorded lectures). In particular completely understand the advanced shallow and deep copy example in depth. Also, study Lab1 Solution from “Sample labs 4-6 and Solutions” folder which is similar to this lab. 1) Add a copy constructor to your MyDate, MobilePhone, MobilePlan, PersonalPlan, BusinessPlan, User, Address, and MobileCompany 2) Implement Cloneable interface (override clone ( ) method) for MyDate, MobilePhone, MobilePlan, User, Address, and MobileCompany. Note that PersonalPlan and BusinessPlan don’t need to implement Cloneable as it is the same as their parent MobilePlan. 3) Write static methods in MobilePlan class to make shallow and deep copy of an ArrayList of plans. Use only the clone ( ). Copy constructor is not needed as it doesn’t work with inheritance and polymorphism: ArrayList< mobileplan=""> shallowCopy(ArrayList< mobileplan=""> plans) ArrayList< mobileplan=""> deepCopy(ArrayList< mobileplan=""> plans) 4) Write static methods in User class to make shallow and deep copy of an ArrayList of users (The same as 3). 5) Add a method ArrayList
deepCopyPlans() to the User to create a deep copy of user’s plans. 6) Add a method ArrayList shallowCopyPlans() to the User to create a shallow copy of user’s plans. 7) Add a method ArrayList deepCopyUsers() to the MobileCompany to create a deep copy of all the users within the company. 8) Add a method ArrayList shallowCopyUsers() to the MobileCompany to create a shallow copy of all the users within the company. 9) Implement Comparable interface for MobilePlan to compare MobilePlans based on the expiry date. Note: you need to make MyDate comparable too. 10) Implement Comparable interface for User based on the city name. Note: you need to make address comparable too. 11) Add compareTo1() to the User based on the total plan monthly payments for the plans he owns. This can be replaced with the compareTo() if required. Note: assume a constant flatRate. 12) Add a method ArrayList sortPlansByDate() to the User to sort all the user’s plans based on the expiry date (using Comparable) and return it as an ArrayList. Note: You need to use Collections.sort(). 13) Add a method ArrayList sortUsers() to the MobileCompany to sort all the company’s users based on the city name (or total monthly payments if you manually change compareTo() and compareTo1() in User class and return it as an ArrayList. 14) Add this to your test code: - For a user call deepCopyPlans() and shallowCopyPlans() to make deep and shallow copies of user’s plans and store these lists in the test code. - change the user’s city to “New York” and add a new plan to his plans. - sort the user’s plans by calling sortPlansByDate(). - print the shallow and deep copy lists as well as user’s plans and see how these three lists are compared. - For a mobileCompany call deepCopyUsers() and shallowCopUsers() to make deep and shallow copies of company’s users and store these lists in the test code. - add a new user to the company. - sort the company’s users by calling sortUsers(). - print the shallow and deep copy lists as well as company’s users and see how these three lists are compared. - make a clone of the mobileCompany in your test code and test to show it is a deep copy.