Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pre-Lab: You will write a program that will allow the user to search the United States by state Abbreviation, Name, and Capital. Please review the

Pre-Lab:

You will write a program that will allow the user to search the United States by state Abbreviation, Name, and Capital. Please review the Powerpoints "File Input w/ Arrays" and "Linear and Binary Search". Download the attached states.txt into your working folder.

Part One:
Create a class called State.java.
Data fields include name, abbreviation and capital.
Write a 3-arg constructor.
Write accessor methods for each of the data fields.
Write a to String method. Use " " if you want the returned string to appear on multiple lines.
 
Part Two:

Create a class called StateFinder.java. Create an array of State objects, size 51. Fill the array using a file-reading Scanner. Close the Scanner after you finish filling the array. Use a while loop to present a menu of choices allowing the user to search by name, abbreviation, or capital. Name should be found using a binary search (do this using methods similar to those shown in Power point). Abbreviation and capital should be found using a linear search. Please use ONE method for linear search. To do so, pass in an integer argument to the search method to indicate which data field is being searched. For example, 1 for abbreviation and 2 for capital.

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

8 What personal development is elearning good at providing?

Answered: 1 week ago

Question

6. What is process reengineering? Why is it relevant to training?

Answered: 1 week ago