Question: to read the file in the code, make 2 arraylists to read the file and use scanner. 7:28 4G Done S21_CMP416_LAB1 - Java IO CMP
7:28 4G Done S21_CMP416_LAB1 - Java IO CMP 416- Internet and network computing Lab 1 - File 10 Objectives: . File 10 As the first step to build an advanced phone directory program you are asked to build the data model and validate it. You have the data from a previous project in the following textual format: Mohamad Ahmad 509443432 Jack John 62320034 West Orient 524332345 Twist Oliver 54323432 Where every line represents one contact info, the first word is the last name followed by the first name and ended with the phone number You need to develop a serializable java class called Contact to contain the first name as String, last name as String and the phone as Integer. You should also write setters, getters and toString functions. You should do the following steps: Create a text file to contain your data, call it input.txt. Create an object of type ArrayList to hold your contacts list, call it contsl. . Read the contacts from the file input.txt and save them in the contal list. Save the contacts in contsl list as objects in a binary file call contacts.dat. - Read the content of contacts.dat filc into another contact list (conts2). Print the contacts in conts and conts2 to the user, along with an equality check using both operator and equlas method. You should get the following output: . It is clear that both -- and equals() return false, but they are not equivalent! Why we are getting this weird result? Can we update the implementation of the Contact class so at least equals() will work as expected
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
