Reference no: EM132990545
COIT 20245 Introduction to Programming - Central Queensland University
Assessment - JAVA Program using array of objects
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: GradingSystemMenu.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 have to complete the code. You will need to write comments in the supplied code as well as your own additions.
Assignment Specification
You have completed the console program for processing grade of students for COIT20245. We are going to extend this application so the students name, student number, marks and grades can be stored in an array of objects, do not use ArrayList.
The program will run via a menu of options, the file GradingSystemMenu.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 seven private instance variables:
o studentName as a String
o studentID as a String
o assignmentOneMarks as double
o assignmentTwoMarks as double
o takeHomeExamMark as double
o individualTotalMarks as double
o grade as a String
The numeric literal values, like P=50.00, HD=85.00 must be represented as constants. The following public methods will have to be implemented:
o A default constructor
o A parameterised constructor
o Five set methods (mutators)
o Five get methods (accessors)
o A method to calculate total marks and return student's total marks as double - calculateIndividualTotalMarks(). This calculation will be the same as in assignment one.
o A method to calculate grade and return the grade as String - calculateGrade(). This calculation will be the same as in assignment one. Use constants for all numeric literals.
Note: Following basic database principles, calculated values are not usually stored, so in this case we will not store the grade as a instance variable, but use the calculateGrade() method when we want to determine the grade.
GradingSystemMenu class
Once the Student class is implemented and fully tested we can now start to implement the functionality of the menu system.
Data structures
For this assignment we are going to store the students names, student number and assessment marks an array of Student objects.
Declare an array of Student objects as an instance variable of GradingSystemMenu 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 for the index into the array of Student objects.
Menu options
1. Enter students name, student number and assessment marks: enterStudentRcord() You will read in the student's name, student number and assessment marks as you did in assignment one.
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 and student number name cannot be blank i.e. not null and the assessments marks needs to be within the range of (0-assessment weighting), the same as assignment one.
When entering record of student's name, student number and assessments marks, the student have been entered successfully into five local variables you will need to add these values into the Student
object array, you will also need to increment a counter to keep track of the number of students you have entered and the position in the array of the next student to be entered.
When the maximum number of students record is reached do not attempt to add any more student's record and give the following error message:
When the student details have been successfully entered, display the details of the student and the charge as follows:
Note: For the next three options, display all, statistics and search you should ensure at least one student's record has been entered and give an appropriate error message if it there are no students record entered and for the sorting option you must ensure at least two student records have been entered, for example:
2. Display all student's name, student number, assessment marks and grade:
displayAllRecordsWithGrade()
When this option is selected display all the records with grade which have been entered so far.
3. Display statistics: displayStatistics()
When this option is selected you will display the statistics as per detailed in assignment one document. You can loop through your array of objects to calculate this information.
4. Search for a student record: searchStudentRecords()
You can just use a simple linear search which will be case insensitive.
If the search is successful display the details about the student record as below.
If the search is unsuccessful display an appropriate message.
5. Sort the student records: sortStudentsRecrod()
This option you will sort the records alphabetically (ignore case) by the student's name, 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.
Remember the welcome and exit messages as per assignment one.
Attachment:- Introduction to Programming.rar