Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Add method

 The data file statedata.dat in the canvas files for Week  1 is a plain text file containing three pieces of information for each state in the United States:

  • the name of the state
  • the state capital
  • the population (as of July 2015)

each item is on separate line in the file, such as

Alabama

Montgomery

4858979

Alaska

Juneau

738432

Arizona

Phoenix

6828065

 and so on …

Your task, after reading Appendix B– Software Flexibility, is to create a software package as a NetBeans project that contains three classes:

  • an executable class for the project itself
  • a class of states, with the properties name, capital, and population
  • a class for an array of state objects

The state and array classes should contain appropriate properties and methods to work with those properties. 

Your project’s class (with the same name as the package) should contain a main method, and methods to test your other classes as follows:

  • load the data from the data file into the array of states.
  • print the list of states -- including each state’s name, capital and population  -- with the data for each state on a separate line.
  • a method that asks the user for the name of a state, then either displays the data for that state, or says the state was not found in the list.

The main method should simply call the other methods in the class to show that they work.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question