This assessment item is designed to test your understanding of GUIs, array/ArrayLists, methods, sorting and searching.
For this assignment you are required to develop a Graphical User Interface (GUI) java program to demonstrate you can use Java constructs including input/output via a GUI, Java primitive and built-in types, Java defined objects, arrays or ArrayList, selection and looping statements and various other Java commands. Your program must produce the correct results. The application scenario is described as below.
Assume a software company needs to develop a Java application for a primary school to manage their student exam results for two subjects – English and Mathematics. You are required to assist this software company to design and implement this java application to display, sort and search student exam results for two subjects – English and Mathematics, as well as the total score of two subjects. The required Java Windowed Application contains a GUI as below in Figure 1. The GUI components from top to bottom include four buttons, one text field and a textArea.
Some details of how the program functions
1. Sort by Name
Initially data of student exam scores (which are unsorted) are stored in three arrays - student name, scores for English and Mathematics. The total score is simply to add English and Maths score in the program. The sample data in Figure 1 has 17 student records. For simplicity, you should enter these sample data in your program code where you use three parallel arrays or arrayList to represent student name, English score and Maths score. In the real world applications, the data usually are stored in either a database or a data file). When the button ‘Sort by Name’ is clicked, the student names are sorted in ascending order based on their names and accordingly the scores are also listed to reflect this order change, as shown in Figure 2.
2. Sort by Total
When the button ‘Sort by Total’ is pressed, the total scores are sorted in ascending order and accordingly the student names and the English/Maths scores are also listed to reflect this order change, as shown in Figure 3.
Note: In the implementation of both functionalities – Sort by Name and Sort by Total, you must use a sort method which has two loops; you can’t use the inbuilt sort method within Java
Arrays class because you will need to sort the four arrays simultaneously by using the name or total score as the sort criteria. For simplicity, you can use a simple algorithm like bubble sort algorithm which we may provide partial code to describe its principle.
When the user enters a name in the search text field (as shown in Figure 4a) and then clicks the Enter key on the keyboard, a message box is popped out to display the search result as shown in Figure 4b. The user should enter a student’s full name regardless of the lower case or upper case in the name spelling. If the entered name doesn’t match any existed one, it pops out a warning message, as shown in Figure 4c.
If the user clicks ‘Statistics’ button, a small message box pops out to display the statistical result including average, highest, lowest scores and the number of students exceeding the average total score (which should be determined by the program code, rather than by manual calculation) as shown in Figure 5.
Clicking ‘Exit’ button will exit the execution of the program.
You may use any design that meets the specification. However, a good design will adhere to the following guidelines:
• be logically correct
• be easy to read and maintain
• be well-designed
• use UML class diagram
• use following methods and class
• should use arrays or ArrayList
• the GUI components on the JFrame by using FlowLayout
• A hint/assistance file (or ass2.jar - executable file) might be available at later stage
public class AcademicDataManager extends JFrame
//declare some variables here
public AcademicDataManager( ) //constructor
public void sortByName( )
public void sortByTotal( )
public void search( )
public void statistics( )
helper methods here
public static void main(String [ ] args)
Testing is important. You should:
• list the different types of test cases.
• display the results of each test case (like screen shots).
What to submit
You should submit online the following files:
• AcademicDataManager.java (this file contains java source code for class AcademicDataManager and main method)
• Report.docx (this file contains a brief report – maximum 6 pages that includes student name, student ID, course name/code, test cases with screen shots and UML class diagram, as well the any problem you may encounter. ) You can use Alt-PrtScn to capture the application window and paste it into your Word document.
Assessment marking criteria
Total Marks – 20
Design, logic, and testing -7
Code readability – appropriate use of comments, indentation and naming conventions
Declaring and using variable
Creating /declaring and using objects, methods and class
Overall design and logic (structure, efficiency)
Validity of testing as evidenced by submitted test results
UML class diagram
Compilation and execution - 12
( 0 mark – if your application doesn’t execute)
Sort by Name button works
Sort by Total button works
Sorting algorithm implemented correctly
Search works with correct result
Statistics button works with correct result
Exit button works
GUI overall layout
Overall program execution
Report - 1