Coit20245 T123 Ass2
Coit20245 T123 Ass2
Coit20245 T123 Ass2
Length: N/A 2
Objectives
This assessment item relates to the unit learning outcomes as stated in the Unit Profile.
Details
For this assignment, you are required to develop a Menu Driven Console Java Program to
demonstrate you can use Java constructs including input/output via the console, Java primitive and
built-in types, Java defined objects, arrays, selection and looping statements and various other Java
commands. Your program must produce the correct results.
The code for the menu and option selection is supplied: RockyCollegeMenu.java and is available
on the unit website, you must write the underlying code to implement the program. The menu
selections are linked to appropriate methods in the given code. Please spend a bit of time looking at
the given code to familiarise yourself with it and where you must complete the code. You will need to
write comments in the supplied code as well as your own additions.
Please submit your source code as a zip or your zipped Netbeans project folder.
o Ass2.zip
A report including an UML class diagram of just your Student class only, how long it took to create
the whole program, any problems encountered, and screenshots of the output produced including
annotations of your testing. (Use Alt-PrtScrn to capture just the application window and you can paste
it into your Word document) You should create a test plan and test every possibility in the program
including known results. You need to show the results of the testing. Also please include your code as
text in the appendix.
o ReportAss2.docx
You will submit your files by the due date using the “Assignment 2” link on the Moodle unit website
under Assessment … Assignment 2 Submission.
The program will run via a menu of options, the file RockyCollegeMenu.java has been supplied (via
the Moodle web site) which supplies the basic functionality of the menu system.
Look at the code supplied and trace the execution and you will see the menu is linked to blank
methods (stubs) which you will implement the various choices in the menu.
Student class
First step is to create a class called Student (Student.java).
The Student class will be very simple it will contain three private instance variables:
o studentName as a String
o studentID as an integer
o studentMark as a double
The numeric literal values maximum students, minimum and maximum marks (i.e. zero and one
hundred), the different grades cut-offs, the different rebate percentage values and unit charge must be
represented as constants.
A mark greater than or equal to 75 and less than 85 the grade will be “D”.
A mark greater than or equal to 65 and less than 75 the grade will be “C”.
A mark greater than or equal to 50 and less than 65 the grade will be “P”.
A student which receives a grade of “HD” will receive a rebate of 10% on their unit charge.
A student which receives a grade of “D” will receive a rebate of 5% on their unit charge.
A student which receives a grade of “C” will receive a rebate of 2% on their unit charge.
Students with a grade of “P” or “F” will not receive any rebate.
Note: you do not need to pass the mark as a parameter as you can access the instance variables
directly within the class. The calculations will be the same as assignment one:
Note: Following basic database principles, calculated values are not usually stored, so in this case we
will not store the grade or rebate as a instance variables, but use the calculateGrade() and
calculateRebate() methods when we want to determine the grade and rebate.
Rocky College offers diploma courses (one year) for easy entry into university courses. Major
universities have agreed to give students full credit for the units they have studied at Rocky College.
Rocky College boasts small class sizes, state of the art facilities and one on one help if required.
Initially (only once at the beginning of the program), the coordinator will be prompted to enter the
unit code for their unit. You must write a validation loop to ensure the unit code is not empty. This
will happen before the menu is displayed.
Data structures
For this assignment we are going to store the student names, student IDs and marks in an array of
Student objects.
Declare an array of Student objects as an instance variable of RockyCollegeMenu class the array
should hold ten students.
You will need another instance variable (integer) to keep track of the number of the students being
entered and use this to keep track of the number of entries in the array of Student objects.
Menu options
1. Enter student name, student ID and mark: enterStudent()
You will read in the student’s name, student ID and mark.
Data validation (you can implement this after you have got the basic functionality implemented)
You will need to validate the user input using a validation loop.
The student’s name cannot be blank i.e. not an empty string or null. The student ID cannot be blank
and must be numeric (integer) (hint: read this in as a string use the isStringNumeric(idStr) method
supplied in the skeleton code and use Integer.parseInt(idStr) to return the integer once verified). The
mark needs to be greater than or equal to zero and less than or equal to one hundred, the same as
assignment one.
When the maximum number of students is reached do not attempt to add any more students and give
the following error message:
Hint: use the format string in printf of "%-30s%-12d%-11.2f%-6s$%5.2f\n"). This will line
up the output correctly under the heading.
displayAllStudents()
When this option is selected display all the students which have been entered so far.
This option you will sort the students alphabetically (case insensitive) by the student names, you can
use any sorting algorithm which you like, do not use any in-built sort methods. Display the sorted
list after the sort is complete.
If you just submit the supplied code you will receive zero marks.