Question
Specifics For this assignment you are to: 1. Create a Person Class A Person has three instance variables: 1. a name 2. day of the
Specifics
For this assignment you are to:
1. Create a Person Class
A Person has three instance variables:
1. a name
2. day of the year the person was born (1-366)
3.the city the person lives in
2. Read data from an input file and create an array of Person
The input file will contain an integer which specifies how many lines follow. Each line contains a comma separated list with the info for one Person. The program should create a Person object with the information read in from one line and put that Person object in the array.
For example, the file might look like the following:
3 Paul R. Smith,143,Colorado Springs Mary Smith,103,Denver Fred Flintstone,3,Bed Rock
3. Handle user requests
Once the data has been read in, repeatedly ask the user for a command and execute the command.
These commands can be:
1. s - Search for all Person's from a given city
2. f - Find Person whose birthday is closest to the entered day.
3. p - Print out all Person in an easily readable form.
4. q - Quit
Hint
After connecting your Scanner to the input file, change the Scanner from using white space to using commas and end-of-line as delimiters. If your Scanner is named scan, the following Java statement will accomplish this task: scan.useDelimiter("[,\ ]");
Testing your program
You can use the data file here for testing. I will use a different data file when I run your program.
DATA FILE
13 Paul R. Smith,143,Colorado Springs Mary Smith,103,Denver Fred Flintstone,31,Bed Rock Sue Sitee,68,Sioux City Donald Knuth,288,Sioux City Claudia Allday,178,Seattle Steve,222,Denver Zeke Zyzzyx,46,Grand Junction Ann B. Clayton,312,Colorado Springs Paul Vault,131,Denver Joan Jettson,361,Boulder Michael Moore,259,Detroit Phil M. Up,343,Detroit
thank you so muc
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started