Question
Below is the description of the programming assignment of how it should be. Thanks. You will start a new IntelliJ project that will have an
Below is the description of the programming assignment of how it should be. Thanks.
You will start a new IntelliJ project that will have an executable class for the project and the Occupation class you created last week, but you will design and add a new class for a list of Occupations an OccupationList class. In a sense, this is an extension of last week's project, but we will implement it as a new IntelliJ project.
The new list class in the new project will contain an array of Occupation objects encapsulated within the class to hold the list. The datatype for the array will be Occupation it will be an array of the class of objects you created for the first week's assignment. Encapsulation means the array of Occupations will be "hidden" inside the list class. The software in the class will manipulate the array, but from outside the class no one will even know there is an array in the class just that they can instantiate and work with an OccupationList object.
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() You will instantiate 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. You will add the Occupation class from last week's assignment to the IntelliJ project for this week's assignment. The directions for doing this are included in the chapter. Basically, you need to copy the Occupation class from the old project to the new one, then go into the class and change the package directive.
- an OccupationList class. This new class will contain an array of Occupations. The properties for the class will be the array of Occupation objects and the number of occupations in the list. This class should contain the methods to manipulate the array of Occupations, such as reading data from a datafile into the array, allowing the user to search the list, and printing the list (to the screen). These methods will then be called as needed from the main() method in the executable class.
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 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 their properties, with one occupation's data on each line. You should use the printf command to format the output. Use of the printf command is covered in Chapter 2.
- ask the user for a COS code, then either display the data for that code, or say 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 is required, but you could have more than one.
The OccupationList class itself can call methods from the Occupation class as needed.
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 items should be sufficient. This will let your software work with any list that has up to 1,000 items. This method should update the count property for the list before the method ends.
The data for this assignment is the same as for last week's assignment. Each item is an occupation, with five properties:
- occ The Occupational Classification Code used by United States government agencies to identify a person's primary occupation. (string)
- title the official Department of Labor title for the occupation. (string)
- employed the number of people currently reemployed in the occupation. (int)
- hourly the average hourly wage of everyone employed in this occupation. (double)
- annual the average annual wage of everyone employed in this occupation. (int)
Wages are in US dollars.
The data is real data, accurate as of May 2019, from the United States Department of Labor's Bureau of Labor Statistics, online at: https://www.bls.gov/oes/home.htm (Links to an external site.). This is the most recent data available.
Here is a sample Occupation:
occ: 49-3011 title: Aircraft Mechanics and Service Technicians employed: 133,310 hourly: $32.27 annual: $67,110
The file has one data item on each line, with five consecutive lines constituting the data for one occupation, in the order shown above. Here is what the start of the file looks like:
11-1011 Chief Executives 205890 93.20 193850 11-1021 General and Operations Managers 2400280 59.15 123030 11-1031 Legislators 52280 23.77 49440 11-2011 Advertising and Promotions Managers 25100 68.22 141890
Each class should be in its own file, within the same package in the same IntelliJ project.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started