Question: Java Write a program names SortNames.java to perform the following tasks: 1. Create a new data type named Person with two instance variables: String firstName
Java
Write a program names SortNames.java to perform the following tasks: 1. Create a new data type named Person with two instance variables: String firstName and String lastName 2. Write a method names sortNames as specified in the following header sortNames(Person[] arr, int type) this method should sort Person array based on the type: 1->srot based on last name 2->sort based on first name (both in alphabetic order) 3. Write an application named SortNameApp.java that read names from the data file: the first line (N) in the data file indicates the number of names in the file, followed by N lines and each line in the data file represents a person name. Then sort and print names according to first and last name.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
