Introduction to Programming Using Java

Introduction to Programming Using Java

Introduction to Programming Using Java

Module 5 Assignment

This assignment is to provide practice using arrays and strings along with other Java programming techniques discussed so far in the course.

For this assignment, you will develop a simple auto inventory system which contains the following basic functionality:

• Read the supplied autoInventory.txt file to obtain the auto inventory with the file path supplied as the first run-time parameter.

• Displays a main menu of three selections:

◦ Display Inventory – Displays the inventory in a neat record-based arrangement

◦ Search Inventory – Starts the inventory search processing (see below)

◦ Exits the programming

• Processes searching the inventory

◦ Can search by any field but only one field at a time

▪ Text fields via text searches

• Searches if supplied text is in any part of the field (subset)

▪ Numeric (integer) fields by numeric searches (Year, Mileage, Price)

• Search if supplied number is less than, equal to, or greater than the numeric value of the inventory record field

◦ Searches will list complete records which match the search criteria or an appropriate message if no records matched the search criteria

• This program will only read inventory data, not create or change inventory data.

The following Java requirements for this program in addition to the above and general topics discussed so-far in the course:

• This program should be implemented in a single Java source file

• This program should be implemented with a single class

• This program should contain multiple methods with logic broken up into reasonable functional units

• Internally the inventory data must be maintained in a two-dimensional class Java array 


◦ Java collections can not be used.

• Read in the inventory file with a structure similar to the below:



 inventoryFile = new Scanner(new File(path));


catch (FileNotFoundException except)


 System.out.println("Error: Inventory read failure. Error: " +



You will need the following imports:

import java.util.Scanner;



• Reduce duplication of code as much as practicable

◦ Reduces maintenance issues

• Do incremental development. Start off with loading and displaying the inventory then move on to searching. Do text searching first than tackle searching on the numeric fields.

• Read over the String method documentation. There are many String methods and there is a good chance there is one which can help you do what you are trying to do.

Below are some screen shots of an example implementation. You can make yours better!

See the separate demonstration showing some of the functionality expected.

Please submit your Java source file and a screen print showing your program running in a compressed zip file and submit it using the Blackboard Assignment Feature. Do not email your assignment.
Powered by