Rlab8
COSC 2436 Lab8
Contents
TITLE .............................................................................................................................................................. 1
TIME TO COMPLETE ...................................................................................................................................... 1
COURSE OBJECTIVES – LEARNING OUTCOME .............................................................................................. 1
LAB OBJECTIVES ............................................................................................................................................ 2
SKILLS REQUIRED........................................................................................................................................... 2
HOW TO DO THE LAB ............................................................................................................................ 2
REQUIREMENT LAB............................................................................................................................... 3
HOW TO TURN IN THE LAB ........................................................................................................................... 6
HOW TO GRADE THE LAB .............................................................................................................................. 6
Note: in the instruction of the lab change “yourLastName” to your last name. In the example, change Smith to your last name, change James Smith to your full name, change Mary Lane to the name that users type in from the keyboard (if these words are in this instruction)
TITLE
Review data structures - GradingStudentApplication
TIME TO COMPLETE
Seven weeks
COURSE OBJECTIVES – LEARNING OUTCOME
[LO1]
Provide UML class diagram and the code of data type classes
Provide the pseudo-code or flowchart based on the requirement of a LAB before writing the code of the driver class. Also, can access data members of data type classes
Describe and implement the inheritance relationship between super class and child classes.
Can use abstract classes or interface and apply polymorphism to the real life problem LAB
LO2 Describle and implement operations of unsorted/sorted array based structures
[LO4] Define and implement Singly linked list, Circular Linked List, Double ended Singly Linked List,
doubly linked list, with their operations and Java Linked List
LO5 Describe and implement operations of Hashed data structure
LO7 Describe and implement operations of Binary Search Trees
[LO11] How to evaluate the performance of each operation algorithm of data structure type based on BigO
and Density
LAB OBJECTIVES
-Complete the lab on time (Time Management)
-Can write the pseudo-code
-Can provide UML of data type class
-Can write comments in the program
-Can write the code of data type classes including data members, no-argument constructor, parameter constructors, mutator methods, assessor methods, method toString and other methods
-Can apply Inheritance concept to write the code of child classes that inherits data members, constructors and other methods from parent class
-Can apply Polymorphism: using object of the parent class to point to object of child classes
-Can organize the program with selection control structure: if..else, switch, do..while
-Can create object and can access members of data type class
-Can create and implement operations of the data structure type of Unsorted Optimized Arrayy
-Can create the data structure type of Singly Linked List, SinglyLinked List with Iterator and Java LinkedList
-Can implement insert, fetch, delete, update of LinkedList, ArrayList, Hashtable
-Can create and implement operations of LQHashed structures
-Can create and implement operations of Binary Search Tree
SKILLS REQUIRED
To to this lab, students should review all the concepts required from the previous lab and add the following skills:
-Learn how to create the data structure of type Linked Lists
-Learn the algorithms of the operations, insert, fetch, delete, update of type Linked List structures
-Learn how to show all the nodes in the Linked List structure
-Learn how to declare and use Iterator to insert, fetch or delete, update in the data structure types that learned from the course: Unsorted Optimized Array, SinglyLinkedList with Iterator, LinkedList, Hashed, Hashtable, ArrayList, LnkedList, BinarySearchTree structure
-Work on data from excel files- open read write and close
HOW TO DO THE lab
From now and on yourLastName will be changed to your last name
*Step1:
-Create UML of data type classes: class Student_yourLastName, class Class
-Read the requirement of each part; write the pseudo-code in a word document by listing the step by step what you suppose to do in main() and then save it with the name as LAB _pseudoCode_yourLastName
*Step2:
-start editor eClipse, create the p LAB →LAB name: FA2019_ LAB _yourLastName
-add data type classes
Student_yourLastName.java
Class_yourLastName.java
-Add data structure class:
From different types of data structures that have learned from the couse, you can choose one to store the node Student for you LAB (UnsortedOptimizedArray, SinglyLinkedList with or without Iterator, LQHashed, BinarySearchTree) and select one data structure type from Java library (ArrayList, LinkedList, Hashtable) as a structure to store the classes of one student
-Add the driver class
GradingStudentApplication_yourLastName.java
*Step3: Write the code of classes:
From UML write the code of data type classes
Write the code of your selected data structure class
Based on the pseudo-code write the java code of main() of the driver class
GradingStudentApplication _yourLastName
*Step4: compile and run the program
*Step5: debug if there is any errors to complete the program
REQUIREMENT LAB
INPUT FILE
-Download file students.xlsx from eCampus, then store to your computer. Open it on the screen, click File, select Save as, select type extension CSV (Comma delimited) then click Save ➔you have file students.CSV
File with the extension CSV is the file the data one row will be a string, the information on cells separate by comma
1212121, Bellamy, Kevin, SP2016-COSC1301, A, FA2016-GOVT2305, A, SP2017-ENGL1302, B, FA2019-COSC2436, X
DATA TYPE CLASSES:
Class STUDENT
-data members: student id (String, generate random number 7 digits), last name (String), first name(String), list of classes (ArrayList or LinkedList or Hashtable to hold all classes of one student)
-no argument constructor, parameter consructors
-method to generate random number with 7 digits
-method to add a class for one student
-method to drop a class for one student
-method to print out the transcript of one student
-more methods if you need for the LAB
Class CLASS
-data members: class name (String), letter grade (char)
The value of grade can be letter A, B, C, D or F – The grade X means the class has registered; not complete yet
-no argument constructor, parameter consructors
DRIVER CLASS
Provide the pseudo-code or flowchart then write the code for the application
*CREATE A DATA STRUCTURE TO STORE ALL STUDENTS – List of students
*READ INPUT FILE, CREATE NODES, INSERT TO DATA STRUCTURE
-display the message and read the name of file that stores the information of students. The file will be provided in excel file with extension .xlsx. You should download it from eCampus, open it on your computer, then SAVE AS with extension CSV (with comma delimited)
Open file to read
For each line (String):
split the line with delimeter as commas. The number of classes of each student is not the same as others. Some students has 5, 10 or other number depending on how many classes that student passed.
For example: one line from the input file:
1212121, Bellamy, Kevin, SP2016-COSC1301, A, FA2016-GOVT2305, A, SP2017-ENGL1302, B, FA2019-COSC2436, X
First column: student id = 1212121
Second column: last name = Bellamy
Third column: first name = Kevin
List of classes:
Class name = SP2016-COSC1301 grade = A
Class name = FA2016-GOVT2305 grade = A
Class name = SP2017-ENGL1302 grade = B
Class name = FA2019-COSC2436 grade = X
For each class name and grade: create one object of Class, insert to the list of classes
Create one object of Student with studentid, last name, first name and list of classes
-insert student to the data structure
-Read line by line and do the same on each line
-close file
*DISPLAY THE MENU:
GRADING STUDENT APPLICATION – JAMES SMITH
MENU
1. Add One New Student from the keyboard
2. Remove One Student
3. Search One Student by ID
4. Add One Class For One Student
5. Drop One Class For One Student
6. Print out the Transcript of One Student
7. Show All Studdents
0. Exit
TASK 1: ADD ONE STUDENT (Insert)
Display message and read information of one student including last name, first name, how many classes are registered?
For each class: ask and read for class name. then create the one object of class with name and the grade X and insert to the list of classes (data structure stores classes)
Create object of Student with lastname, first name and list of classes. The student id will be generated as a random number with 7 digits in the constructor
Insert the new student object to the list of Students (data structure stores students)
Display the information of the new student by calling toString of class Student. Where grade X means Not Complete
NEW STUDENT
Student: Mary Lane
Student ID: 1234567
Classes:
FA2019-MUSI1181 - Not Complete
FA2019-MATH1414 - Not Complete
TASK 2: REMOVE ONE STUDENT (Delete)
Ask for the student id from the keyboard
Delete student with the provided id. Display the message if delete gets success otherwise display the message: Student is not found
TASK 3: SEARCH FOR ONE STUDENT BY ID
Ask for the student id from the keyboard to search
Read student with the id by fetch, if fetch cannot find the student, if fetch is success then display student information with id, last name, first name and the list of classes including class name and grade as below. The class with grade = ‘X’, display “Not Complete”
For example:
Student ID: 1234567
Student: James Smith
Classes:
FA20177-MATH1325 - A
FA2017-PHYS1401 - B
SP2018-COSC1301 - A
SP2018-MATH1414 - B
FA2018-HUMA1302 - A
FA2018-GOVT2305 - A
SP2019-COSC1301 - A
SP2019-ENGL1301 - B
FA2019-MUSI1181 - Not Complete
FA2019-MATH1414 - Not Complete
TASK 4: ADD ONE CLASS FOR ONE EXISTING STUDENT
Users provide the student id
Read information the stutdent with the provided student id
Use the object student call the method to add one new class to the list of claases
Display the informtion of this student in the format same as in TASK3 to verify new classs if insert is usccess; otherwise, display message: “cannot add the class” ‘’
TASK 5: DROP ONE CLASS FOR ONE EXISTING STUDENT
Users provide the student id
Read information the stutdent with the provided student id
Read the name of the class that users want to drop
Use the object student call the method to drop the class from the list of classes.
-If the class already has the grade different ‘X’, display message: “Complete Class – cannot drop” to the list of claases
-If the class has the grade ‘X’, remove from the list of classes, display the message “Drop class <className>”
-If the class does not exist, display the message: “The class does not exist”
TASK 6: PRINT THE TRANSCRIP OR ONE STUDENT
Read the student id from the keyboard
Generate the current date. Then print out the transcript as below:
RiSCHOOL ABC – TRANSCRIPT
-----------------------------
Student: Johnson Kennedy
Student ID: 54321
Date: 10/22/2019
-----------------------------
FA2016-MATH1325 - A
FA2016-PHYS1401 - B
SP2017-COSC1301 - A
SP2017-MATH1414 - B
SP2018-HUMA1302 - A
SP2018-GOVT2305 - A
SP2017-COSC1301 - A
SP2017-ENGL1301 - B
SP2018-MUSI1181 - Not Complete
SP2018-MATH1414 - Not Complete
TASK 7: SHOW ALL STUDENTS
Display all students in data structure on the screen
TASK 0: EXIT
Before terminate the program, do the following
-Open the file “students.csv” to write
-Use the logic similar as the task showAll but write to the file students.csv instead displaying on the screen
With the following format:
id, lastname,firstname,className1, grade1, className2, grade2, etc..
For example:
1212123,Lane,Mary,SP2017-COSC1301,A,SP2017-ENGL1301,B,SP2018-MUSI1181,X,SP2018-MATH1414,X
HOW TO TURN IN THE LAB
Psuedo-code of main()
Student_yourLastName.java
Data structure class java file
GradingStudentApplication_yourLastName.java
Student_yourLastName.class
Data structure class .class file
GradingStudentApplication_yourLastName.java
|
HOW TO GRADE THE LAB Turn in the LAB on time |
10 |
|
Submit all files that need to run your LAB |
2 |
|
compile success with all the requirements |
10 |
|
UML of data type classes and psuedo-code |
3 |
|
Write comments |
3 |