Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA Create a Governor class with the following attributes: name : String party

ID: 3891649 • Letter: J

Question

JAVA

Create a Governor class with the following attributes:

name : String

party - char (the character will be either D, R or I)

ageWhenElected : int

Create a State class with the following attributes:

name : String

abbreviation : String

population : long

governor : Governor

Your classes will have all setters, getters, typical methods to this point (equals(), toString()) and at least 3 constructors (1 must be the default, 1 must be the copy).

You will be turning in the UML diagram - it behooves you to diagram first.

Test your classes with hard-coded data before attempting to create the data structure from the file.

The file that we will be using to create the data structure: governerAndState.csv

The data structure will be an array of objects, NOT an ArrayList. We know that there are 50 states (we are not including US territories or the District of Columbia), so we will use a data structure that contains exactly 50 State objects.

The required operations on the data structure - these are in a services/utilities class NOT in the driver:

display all governors by name -- self-explanatory

display all governors by party --- your method will display a list of options ( Democratic, Republican or Independent) and the user will select (you may consider using JOptionPane buttons for this)

determine and display the youngest governor (when elected since that's what we know) -- self-explanatory

determine and display the oldest governor (when elected) -- self-explanatory

search by governor name, display state --- your method will request of the user a portion of a name, search all of the states for the governor's name and display the state and the state abbreviation where that governor is

change governor --- your method will allow the user to enter the state (you may go by abbreviation here) and the new governor's name, age and party --- your method will change the governor in that state

display state by population --- your method will allow the user to enter a population and display all states that have a population greater than the user request.

display state by first letter --- your method will request a letter of the user, the method will display all states that begin with that letter or a message stating that no state starts with that letter.

display all --- display all information for the state object --- the population should be well formatted, that is with commas every 3rd digit.

Deliverables (zipped)

Governor.java

State.java

StateUtilities.java

StateDriver.java

governorAndState.csv (the data file)

_______________________________________________________________________________________

((governorAndState.csv)

State,State abbreviation,population,Governor name,party,age when elected
Alabama,AL,4858979,Kay Ivey,R,73
Alaska,AK,738432,Bill Walker,I,63
Arizona,AZ,6828065,Doug Ducey,R,51
Arkansas,AR,2978204,Asa Hutchinson,R,65
California,CA,39144818,Jerry Brown,D,73
Colorado,CO,5456574,John Hickenlooper,D,59
Connecticut,CT,3590886,Dan Malloy,D,56
Delaware,DE,945934,John Carney,D,61
Florida,FL,20271272,Rick Scott,R,59
Georgia,GA,10214860,Nathan Deal,R,69
Hawaii,HI,1431603,David Ige,D,57
Idaho,ID,1654930,C.L. “Butch” Otter,R,65
Illinois,IL,12859995,Bruce Rauner,R,58
Indiana,IN,6619680,Eric Holcomb,R,49
Iowa,IA,3123899,Kim Reynolds,R,58
Kansas,KS,2911641,Jeff Colyer,R,58
Kentucky,KY,4425092,Matt Bevin,R,48
Louisiana,LA,4670724,John Bel Edwards,D,50
Maine,ME,1329328,Paul LePage,R,63
Maryland,MD,6006401,Larry Hogan,R,59
Massachusetts,MA,6794422,Charlie Baker,R,59
Michigan,MI,9922576,Rick Snyder,R,53
Minnesota,MN,5489594,Mark Dayton,D,64
Mississippi,MS,2992333,Phil Bryant,R,58
Missouri,MO,6083672,Eric Greitens,R,53
Montana,MT,1032949,Steve Bullock,D,47
Nebraska,NE,1896190,Pete Ricketts,R,51
Nevada,NV,2890845,Brian Sandoval,R,48
New Hampshire,NH,1330608,Chris Sununu,R,53
New Jersey,NJ,8958013,Phil Murphy,D,61
New Mexico,NM,2085109,Susana Martinez,R,52
New York,NY,19795791,Andrew Cuomo,D,54
North Carolina,NC,10042802,Roy Cooper,D,60
North Dakota,ND,756927,Doug Burgum,R,60
Ohio,OH,11613423,John Kasich,R,59
Oklahoma,OK,3911338,Mary Fallin,R,57
Oregon,OR,4028977,Kate Brown,D,55
Pennsylvania,PA,12802503,Tom Wolf,D,67
Rhode Island,RI,1056298,Gina Raimondo,D,44
South Carolina,SC,4896146,Henry McMaster,R,70
South Dakota,SD,858469,Dennis Daugaard,R,58
Tennessee,TN,6600299,Bill Haslam,R,53
Texas,TX,27469114,Greg Abbott,R,58
Utah,UT,2995919,Gary R. Herbert,R,62
Vermont,VT,626042,Phil Scott,R,59
Virginia,VA,8382993,Ralph Northam,D,59
Washington,WA,7170351,Jay Inslee,D,62
West Virginia,WV,1844128,Jim Justice,R,66
Wisconsin,WI,5771337,Scott Walker,R,44
Wyoming,WY,586107,Matthew Mead,R,49

Explanation / Answer

Ok. I know the solution just give me a couple of hours while I code it down for you with detailed comments and screenshots for better understanding. I assure you that you won't be disappointed in the solution at all! :)