Java oriented program code that reads a txt file for a veterinary office. The pr
ID: 3816366 • Letter: J
Question
Java oriented program code that reads a txt file for a veterinary office. The program must have a driver where the program is tested. The program for the veterinary office has human client which has:
A last name
A first name
An address
A client ID
number of visits outstanding Balance
an array of Pets (aggregation)
Each Pet has:
A name
An animal type
A weight
A date of last rabies shot (String)
A date of last visit (String)
Write the constructor methods and toString ( ) method for each class. Write an equals( ) method for the client based on the client id.
Write a program that reads in data from a file to create an array of five Clients with all the fields, including the array of Pets.
The driver will print each client’s information (along with the pet name and type)
File structure:
Last name, first name, address, ID, number of visits, balance, number of pets
Pet name, animal type, weight, rabies date, last visit date
The fields in the file are comma delimited.
The txt.file that the program must be able to read and display
Morely,Robert,123 Anywhere Street,15396,4,234.56,2
Bubba,Bulldog,58,4-15-2010,6-14-2011
Lucy,Bulldog,49,4-15-2010,6-14-2011
Wilder,John,457 Somewhere Road,78214,3,124.53,1
Ralph,Cat,12,01-16-2011,04-21-2012
Miller,John,639 Green Glenn Drive,96258,5,0.00,3
Major,Lab,105,07-10-2012,06-13-2013
King,Collie,58,06-14-2012,10-05-2012
Pippy,cat,10,04-25-2015,04-25-2015
Jones,Sam,34 Franklin Apt B,47196,1,32.09,1
Gunther,Swiss Mountain Dog,125,10-10-2013,10-10-2013
Smith,Jack,935 Garrison Blvd,67125,4,364.00,4
Perry,Parrot,5,NA,3-13-2014
Jake,German Shepherd,86,11-14-2013,11-14-2013
Sweetie,tabby cat,15,12-15-2013,2-15-2015
Pete,boa,8,NA,3-15-2015
Explanation / Answer
Answer:
Here are all the three required classes:
1. Pet.java
-------------------------------------------------------------------------------------------------------------------------------------------
2. Client.java
------------------------------------------------------------------------------------------------------------------------------------------------
3. VetOfficeDriver.java
----------------------------------------------------------------------------------------------------------------------------------------------
INPUT:
vetofficeclients.txt
Morely,Robert,123 Anywhere Street,15396,4,234.56,2
Bubba,Bulldog,58,4-15-2010,6-14-2011
Lucy,Bulldog,49,4-15-2010,6-14-2011
Wilder,John,457 Somewhere Road,78214,3,124.53,1
Ralph,Cat,12,01-16-2011,04-21-2012
Miller,John,639 Green Glenn Drive,96258,5,0.00,3
Major,Lab,105,07-10-2012,06-13-2013
King,Collie,58,06-14-2012,10-05-2012
Pippy,cat,10,04-25-2015,04-25-2015
Jones,Sam,34 Franklin Apt B,47196,1,32.09,1
Gunther,Swiss Mountain Dog,125,10-10-2013,10-10-2013
Smith,Jack,935 Garrison Blvd,67125,4,364.00,4
Perry,Parrot,5,NA,3-13-2014
Jake,German Shepherd,86,11-14-2013,11-14-2013
Sweetie,tabby cat,15,12-15-2013,2-15-2015
Pete,boa,8,NA,3-15-2015
--------------------------------------------------------------------------------------------------------------------------------------------
OUTPUT:
Morely,Robert,123 Anywhere Street,15396,4,234.56
Bubba,Bulldog,58,4-15-2010,6-14-2011
Lucy,Bulldog,49,4-15-2010,6-14-2011
Wilder,John,457 Somewhere Road,78214,3,124.53
Ralph,Cat,12,01-16-2011,04-21-2012
Miller,John,639 Green Glenn Drive,96258,5,0.0
Major,Lab,105,07-10-2012,06-13-2013
King,Collie,58,06-14-2012,10-05-2012
Pippy,cat,10,04-25-2015,04-25-2015
Jones,Sam,34 Franklin Apt B,47196,1,32.09
Gunther,Swiss Mountain Dog,125,10-10-2013,10-10-2013
Smith,Jack,935 Garrison Blvd,67125,4,364.0
Perry,Parrot,5,NA,3-13-2014
Jake,German Shepherd,86,11-14-2013,11-14-2013
Sweetie,tabby cat,15,12-15-2013,2-15-2015
Pete,boa,8,NA,3-15-2015
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.