Question: Object Oriented Programming 1.4 Given the following text file named Residence.txt in Figure 1 that contains the data about the owner of the apartment. The

Object Oriented Programming

Object Oriented Programming 1.4 Given the following text file named Residence.txt in

Figure 1 that contains the data about the owner of the apartment.

The data is comprised of owner's IC number, name, unit, level and

block of apartment. 770123-10-5344;Nuraina binti Ali;23;6:2 721109-14-5665;Ahmad Sabry bin Sukr1;6;2;10 810616-03-5775;Muhammad bin

1.4 Given the following text file named Residence.txt in Figure 1 that contains the data about the owner of the apartment. The data is comprised of owner's IC number, name, unit, level and block of apartment. 770123-10-5344;Nuraina binti Ali;23;6:2 721109-14-5665;Ahmad Sabry bin Sukr1;6;2;10 810616-03-5775;Muhammad bin Tulus;12;5;7 800321-06-5228;Siti Mariah binti Janian;11;3;1 841130-04-5776;kanizah binti Salleh:10;4;5 ... (more data) Figure 1: Residence.txt Write a complete Java program using the file I/O operation that can perform the following tasks: a) Read all records from text file named Residence.txt in Figure 1 b) Store all data into the following output files according to gender: If the owner is a male, then write the data into file named male.txt as shown in Figure 2 If the owner is a female, then write data into file named female.txt as shown in Figure 3 The gender can be determined based on IC number where the last character of IC number represents the gender. if it is an odd number, then the owner is a male; otherwise the owner is a female. Both sample of output files are shown below: List of male puner Nane Init Level re Block Ahmad Sabry bin Sukri Must-armad bin Tulus 6 6 12 10 7 5 Figure 2: male.txt List of female Owner Mane Nuralna binti All siti Mariah binti Jamian Hanlzah binti Salleh unit Level Block ser 6 2 113 1 10 5 Figure 3: female.txt c) Close all file streams in used. d) Apply exception handling mechanism in the program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!