Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program names SortNamesGUI.java to perform the following tasks: 1. Create a new data type named Person with two instance variables: String firstName and

Write a program names SortNamesGUI.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->sort based on last name 2->sort based on first name (both in alphabetic order) 
 3. Design a GUI application as shown in the document *******USE Scanner TO READ FILE INSTEAD OF BufferedReader******* (SEARCH BY FULL NAME I.E. "names.txt", not "names") 4. There are three buttons in the GUI, Load File, Sort First Name, Sort Last Name: 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. 
 When the "Load File" button is clicked on, load names from the file then display the names in the first JTextArea When the "Sort First Name" is clicked on, sort names according to their first name, then last name, display the sorted names in the second JTextArea if two first names are the same, use last name to sort. When the "Sort Last Name" is clicked on, sort names according to their last name, then first name, display the sorted names in the third JTextArea 5. Handle exceptions. For example, file not found, or clicked on sort button before names are loaded. 

image text in transcribed

THE TWO DATA FILES:

names.txt:

30 Stefanie Hooton Eleanora R. Blouin Alla Rundle Dia Gran Bertie Rathman Milly T. Edmond Libbie Filippini Ruthie Arnwine Sebastian Biggers Freida Ravencraft Angelia Bodkin Cicely Kandoll Phebe Nies Daphine Peil Yetta Syring Rudolf Hougland Leola Straube Josefa Starbird Donette Fullmer Bertie Mirelez Merry Rathman Cathern Diamond Rosalyn Arnwine Lillian Carew Lashanda Hendrick Stepanie Lindo Elda Ackermann Valeria Valdovinos Laurette Wedell Alla Gran

______________________

names2.txt:

8 Alla Rundle Dia Gran Bertie Rathman Milly T. Edmond Ruthie Arnwine Rosalyn Arnwine Lillian Carew Alla Gran

LI sorting Names Data ileLoad File Sort First Name Sort Last Name Data file Unsorted list Sorted based on first name Sorted based on last name

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago