IDS 401 Assignment 3: GUI Database

Verified

Added on  2019/09/18

|3
|1080
|251
Homework Assignment
AI Summary
This is a homework assignment for IDS 401, requiring students to convert an existing console-driven employee database application into a GUI application using Java. The assignment specifies the required functionalities and components, including a DatabaseGUI class extending JFrame, a JTextField for user commands, a JTextArea for displaying results, and JButtons for loading and saving data. It also includes an Employee class with private fields and get/set methods, and a Database class for managing employee records with methods for matching, modifying, adding, deleting, and reading employee data. The assignment emphasizes specific formatting and file handling requirements, and the program should be written as a single .java file.
tabler-icon-diamond-filled.svg

Contribute Materials

Your contribution can guide someone’s learning journey. Share your documents today.
Document Page
IDS 401
Fall 2016
Assignment 3
Due Friday 11/18/2016
60 points
Instructions
Deadline
In order to receive full credit, this assignment must be submitted by Friday, November 18th at 11:59pm.
Submitting your assignment early is recommended, in case problems arise with the submission process.
Late submissions will be accepted (but penalized 10pts) up to one week after the submission deadline.
After that, assignments will not be accepted.
Assignment
Convert your existing console-driven employee database application to a GUI application. Submit your
code via Blackboard, as a single .java file. Only one upload is permitted per student, so please
ensure your code is correct and complete and in the proper format before uploading! The file name
should be your last name, first name, and DatabaseGUI run together:
EX: LundquistDougDatabaseGUI.java.
The required functionalities & components are:
1. A DatabaseGUI class that extends JFrame, contains a Database object from 3., below, and
includes:
a. A JTextField for entering user commands with the following formats (user-specified
parameters in italics):
i. "add lastName firstName department id jobCode"
ii. "modify field matchValue newValue"
iii. "delete lastName firstName department id jobCode"
iv. "read field matchValue"
v. Each command should be entered as a unit and parsed (for example, using a
StringTokenizer with a space character delimiter) – do not separately enter the
action and then each individual parameter
b. A JTextArea for displaying results or other messages following command processing
c. Two JButtons:
i. labeled "Load", for loading an Employee array from file "C:/data/IDS401.dat"
ii. labeled "Save", for saving an Employee array to file "C:/data/IDS401.dat"
2. An Employee class that contains data about individual employees
a. Fields: For this assignment, all Employee fields are private and should only be accessed
from outside classes using the appropriate get & set methods
i. Strings: lastName, firstName, department
ii. ints: id, jobCode
b. Methods:
i. Set: One “set” method (e.g., setLastName) for each field, which accepts the field’s
type as a parameter and sets the field’s value to that parameter
ii. Get: One “get” method (e.g., getLastName) for each field, with the same return type
as the field (e.g, a String for getLastName) and leaves the field unchanged
3. A Database class that maintains records of employees:
a. Fields:
i. an array e of Employee objects, with the initial size set to zero
ii. a counter for the current number of Employees in e, initialized to zero
b. Methods:
tabler-icon-diamond-filled.svg

Secure Best Marks with AI Grader

Need help grading? Try our AI Grader for instant feedback on your assignments.
Document Page
i. match: Requires two Strings as parameters, named field and matchValue.
1. Returns a boolean value.
2. Uses a for loop to scan e, looking for matches
3. If the field is “lastName”, returns true if the lastName attribute of any Employee
object has the same text as matchValue, otherwise false
4. If the field is “firstName”, returns true if the firstName attribute of any Employee
object has the same text as matchValue, otherwise false
5. If the field is “department”, returns true if the department attribute of any
Employee object has the same text as matchValue, otherwise false
ii. modify: Requires three Strings as parameters, named field, matchValue, and
newValue.
1. Returns nothing (void).
2. Uses a for loop to scan e, looking for matches
3. If the field is “lastName”, sets the lastName attribute to newValue for any
Employee object that has the same text as matchValue
4. If the field is “firstName”, sets the firstName attribute to newValue for any
Employee object that has the same text as matchValue
5. If the field is “department”, sets the department attribute to newValue for any
Employee object that has the same text as matchValue
6. After successfully executing the modify command, the GUI JTextArea should
display a message indicating the number of affected Employee objects, such as
“7 employee records modified”
iii. add: Requires three Strings (named lastName, firstName, and department) and two
ints (named id and jobCode) as parameters.
1. Returns void.
2. Creates a new Employee object using the five parameters for the corresponding
fields
3. Assigns the new Employee object to the next unused index in e
4. Updates the employee counter
5. No provision for expanding the array is required
6. After successfully executing the add command, the GUI JTextArea should
display the message “new employee added”
iv. delete: Requires three Strings (named lastName, firstName, and department) and
two ints (named id and jobCode) as parameters.
1. Returns void.
2. Uses a for loop to scan e, looking for matches
3. Any Employees for which the lastName, firstName, department, id, and jobCode
match the method parameters are deleted (set to null)
4. Following any deletion(s), the employee counter must be updated and the array
contents compressed so that the employee counter indicates the first unused
index in the array
5. After executing the delete command, the GUI JTextArea should display text
indicating how many Employee records were deleted (even if zero)
v. read: Requires two Strings as parameters, named field and matchValue.
1. Returns nothing (void).
2. Uses a for loop to scan e, looking for matches
3. If the field is “department”, displays all Employee objects whose department field
has the same text as matchValue
4. If the field is “jobCode”, displays all Employee objects whose jobCode field has
the same text as matchValue
5. Any matching Employee objects have all their attributes printed to the GUI
JTextArea object (one line per Employee object)
6. If no matching Employee objects are found, the GUI JTextArea should display
the message “no matches found!”
Document Page
Program Code Constraints
The program should be written as a single .java file (the Database and Employee classes should be
included in the DatabaseGUI.java file, after the DatabaseGUI class declaration). Comments should be
provided describing the usage of variables and purpose of methods.
chevron_up_icon
1 out of 3
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]

Your All-in-One AI-Powered Toolkit for Academic Success.

Available 24*7 on WhatsApp / Email

[object Object]