Laboratory Exercise for Week 3
This lab is designed to give you further experience in designing and coding Java objects. You will create a worker class Person that contains information about a person's name, and an applicaion class that creates four Person objects and prints them in several ways.You may have noticed that cultures in Asia usually give the surname first when using a person's name. Persons from these cultures often continue that preference even when relocated to a Western locale. Your Person objects will record the surname and given name of a person, along with the preference that person has for the way the name is said or written. Moreover, it will provide accessor ("getter") methods to produce the name in Western, Asian, and the preferred form, as well as to access the preference and the parts of the name.
Requirements:
Next, your TestPerson's main method must print the results of the accessor methods for one of the Person objects (it doesn't matter which one, and you should do this for only one).
Finally, your TestPerson's main method must change the preference in the Person which was just printed, and then print the preferred name of that Person.
Running your application must produce output like this:
$ java TestPerson
Western names:
Mary Roe
John Doe
Chong-il Kim
Dae-jung Kim
Asian names:
Roe Mary
Doe John
Kim Chong-il
Kim Dae-jung
Preferred names:
Mary Roe
John Doe
Kim Chong-il
Kim Dae-jung
Parts:
Given name: Dae-jung
Surname: Kim
Preference: true
New preferred name:
Dae-jung Kim
To Turn In:
Due Date: All parts must be handed in by 9 p.m. on Friday, April 18 using handin to the "Lab3b" folder. .
14 April 2003 csturner@csc.calpoly.edu |
Back to CPE 101 page |