CSC 120 Programming Assignment 8 Option 1
Modified PA7
Note: You should not work on this assignment during class-time unless:
- You have completed all of the in-class assigned work for the day, and
- You have permission from the instructor.
This assignment must be handed in to your instructor's handin
folder before the beginning of class on the due date.
Description:
You will add to your PA7 project the ability to read the starting values for the array of objects
you processed in PA7 from a
JTextArea in the user interface. All the rest of the functionality that was part of PA7 must still
work correctly. This generalizes your program so that it can process an arbitrary number of objects,
based on the size of the input that is entered when the program is run.
To start this project, make a new NetBeans Java Application project called PA8
, and copy all of the
files in the src directory of your PA7 project into the src directory of the new project. Run
your PA8 project to make sure it works correctly before continuing.
User Interface changes:
You will need to add a JButton to the user interface that says "Read Input Data" or something like that.
You can either use the JTextArea that displayed the output in PA7 for input in PA8, or you could add a separate
JTextArea to your interface that will be used exclusively for reading the input -- whichever looks better
to you is acceptable. But you will need to have a place to paste text representing the data to be processed
by your program so that it can be split and trimmed when the "Read Input Data" button is clicked by the user.
Input format:
Each line of the input will consist of all values that are needed to fill up the properties of your
class of objects used in your program. In other words, any values that need to be passed into the
constructor method of your objects needs to be part of the input text. You should separate the
data values in each line of text by a delimiter
character, maybe a # character or something else that won't be part of any of the data values to be
entered. Note that you should use the trim
method of the String
class to remove
all leading and trailing spaces from the parts of the input line that you split using your delimiter
character before processing the values in your program.
For an example of how you must convert your separate array element instantiations into a data file, click on THIS LINK.
IMPORTANT: You MUST delete the instantiations of your array elements that were in PA7, or you will
receive a 25 point penalty for this assignment. There cannot be any data values built
into the code of the program.
Turn in data files along with program:
You must store 2 .txt files in the src folder of your project that represent two different sets of
input data that can be processed by your program. This will be used to test your program to ensure
that it can process data formatted in the style required by your program. These two files must contain A DIFFERENT
NUMBER OF LINES!!
It is expected that each student will complete this assignment INDIVIDUALLY.