Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The data file occupations.txt in the canvas files for Week 1 is a plain text file containing information about employment in specific occupations in the

The data file occupations.txt in the canvas files for Week 1 is a plain text file containing information about employment in specific occupations in the United States from the US Dept. of Labor in May of 2018. This is real data compiled from wage and employment surveys. Each data set has four lines of information:

COS - The 6-digit Standard Occupational Classification (SOC) code for each occupation

title - the title of the occupation

employment - the number of people in the US employed on this occupation

salary - the average salary for all people employed in the US in this occupation.

Here is data from the middle of the file:

15-1132 Software Developers, Applications 903,160 108,080 15-1133 Software Developers, Systems Software 405,330 114,000 15-1134 Web Developers 127,300 75,580 15-1141 Database Administrators 110,090 92,030

Each set of data has one data item per line over four lines, starting with the line that has the COS code. For example, 15-1133 is the code for Software Developers, System; 405,330 people were employed in this occupation in the US at the time the data was collected; and they had an average annual salary of $144,000.

The salaries are the average for all employees throughout the United States in each category. Starting salaries for recent graduates tend to be lower. Salaries for more experienced people in each category tend to be higher. Salaries can also vary throughout the country by location.

Your task is to create a software package as a Java project that contains three classes:

an executable class for the project itself. This class should contain your main() method, with an instance of the OccupationList object in the main() method, but no array should be declared in the main() method, nor anywhere in the project class.

an Occupation class with the properties COS, title, employment, and This class should contain methods to manipulate properties of an Occupation, such as getting and setting the properties, along with a toString() method that will return a String with a line of information about an occupation.

an OccupationList class for a list of occupations as an array, with an Occupation array and the number of occupations in the list as properties. This class should contain the methods to manipulate the array of occupations, such as reading data into the array from a datafile, allowing the user to search the array, and printing the array (to the screen).

The purpose of this assignment is to make sure you can work with data files, work with arrays, and create software with multiple classes.

Your executable class (with the same name as the package) should contain a main() method, should instantiate an instance of the OccupationList class, and should call methods from other classes as needed to:

load the data from the data file into the array of occupations.

print the list of occupations -- including the four properties for each occupation, with one occupation's dtaa on each line.

a method that asks the user for a COS code, then either displays the data for that code, or says the code was not found in the list. if you would like, you can create a method that does this by title. Only one of these search functions us needed, but you could have more than one.

Remember -- there should be no array in the project class or the Occupation class. The OccupationList class should contain the array of Occupation objects and the methods to manipulate the array. The main() method should call methods from the other classes as needed.

You may either ask the user for the name of the data file or hard code it into the project. Either is acceptable.

Your method to read data into the file should work independently of the exact number of data items in the file, so you should use a while loop that counts how many items it reads in as it loads the array. An Occupation array of 1,000 should be sufficient. This will let your software work with any list that has up to 1,000 items. Here is an example from a different project of one way to set up the read loop:

count = 0;

while ( infile.hasNextLine() ) {

// read data from the file into temporary variables // read Strings directly; parse integers inName = infile.nextLine(); inType = infile.nextLine(); inPrice = Integer.parseInt( infile.nextLine() ); inRent = Integer.parseInt( infile.nextLine() ); inColor = infile.nextLine();

// initialize an element in the square array using the BoardSquare class constructor square[i] = new BoardSquare(inName, inType, inPrice, inRent, inColor);

count++;

} // end while

// the method returns count as an integer.

Each class should be in its own file, within the same package in the same project.

Please ask me if you have any questions or run into any trouble while working on your assignment.

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

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago