COSC 1437 – LAB6
TITLE
Array, Array Access – Student Grading Application
HOW TO DO PART 2
*From now and on yourLastName will be changed to your last name.
*Your program should change White to your last name.
*Your program should change McKINLEY WHITE to your name.
*Change Mary Lane to the name of user who is using the Investment Application entered from the keyboard.
*Write the file name as the first comment line at the top of the program.
*After running your program, get the picture of the output window from your program with your name on to paste at the bottom of the pseudo-code to turn in.
*Step1: Read the requirement of each part; create the UML of data type class, write the pseudo-code of driver class 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 Lab6_pseudoCode_yourLastName.
*Step2:
-start editor (for example eClipse) create the project with the following project name:
Part 2: SU2021_LAB6PART2_yourLastName
-add data type class:
Part2: Student_yourLastName
-add a driver class (that contain main()
Part 2: SU2021_StudentGradingApplication_yourLastName
*Step3: follow step by step in the pseudo-code (or the flowchart) to write the java codein main() or driver class.
*Step:4 compile and run the program.
*Step5: debug if there are any errors to complete the program.
LAB6 PART1
Open a word document the provide the answers to the following questions:
QUESTION 1:
Look at the following array definition
int [ ] values = { 3, 6, 2, 5, 7, 8};
What is the output of the following lines?
System.out.println(values[4]);
x = 2* values[3] + values[5];
System.out.println(x);
x = 3+ values[2]++;
System.out.println(x);
QUESTION 2:
Class Rectangle has two data members, length (type of float) and width (type of float).
Method setLength(float len) í the mutator method and the method getLength() is the accessor method of class Rectangle
void setLength (float len)
{
length = len;
}
void getLength ()
{
return length;
}
The following statement creates a Rectangle array with size 2 :
Rectangle[ ] rectangleSet = new Rectangle[2];
Is it correct or not to execute the following statements? What is the output? If it is not correct, write the correct one[1]
- rectangleSet[1]. setLength(12.59); System.out.println(rectangleSet[1].getLength());
- rectangleSet.setLength(4.15); System.out.println(rectngleSet.getLength()):
QUESTION 3:
Use the following int array
int [ ] Numbers = { 57, 25, 14, 63, 38, 42, 15, 80, 76, 40 }
Open file output.txt to write then provide the code to write the values of the array Numbers to the file with the
following format. Remember to close the file.
Numbers 0 = 57
Numbers 1 = 25
Numbers 2 = 14
Numbers 3 = 63
Numbers 4 = 38
Numbers 5 = 42
Numbers 6 = 15
Numbers 7 = 80
Numbers 8 = 76
Numbers 9 = 40
QUESTION 4
Write the code of data type class rainfall_Information_yourLastName including data member with one float array of size 12 to store the rainfall of 12 months in the year.
Write the no-argument constructor, parameterized constructors of this class.
LAB6 PART2
Provide an application that can help to calculate the scores and determine the grade of students
This application requires to have data type class Student_yourLastName and driver class SU21_StudentGradingApplication_yourLastName with applying array
DATA TYPE CLASS
Class Student_yourLastName that holds studentId (String), lastname (String), firstname (String), scores (ARRAY OF FLOAT NUMBERS SIZE 3) that stores 3 scores of 3 tests. Max score of each assignment is 100.
In the data type class you should have no-argument constructor, parameterized constructor. -*provide the method calculates the total of scores,
*provide the method calculates the percentage
percentage = 100 * total of scores of 3 tests in the array / total max scores of 3 tests
*provide the method to determine the letter grade
Percentage Letter grade
>= 90 A
>= 80 B
>= 70 C
>= 60 D
< 60 F
*provide the method toString() to create the output string.
For example if the total score = 256.75 and total of max scores of 3 assignment is 300. The method toString() must return the String in the following format:
File name: StudentGradingResult_White.java
STUDENT GRADING APPLICATION – McKINELY WHITE
————————————————–
Student ID: 1234567
Student Name: Mary Lane
Total of Scores: 256.75 / 300
Percentage: 85.58%
Letter Grade: B
*provide the method toFile() to create the output string in the following format:
studentId-lastname-firstname-percentage-letterGrade
For example:
1234567-Lane-Mary-85.75-B
DRIVER CLASS
The application creates the class SU2021_StudentGradingApplication _yourLastName.
First, display message to display the menu and read the task. After finishing one task, redisplay the menu to allow users to continue using the program until users select 0 to terminate the program.
SU2021_StudentGradingApplication_White.java
GRADING MENU – Mc KINLEY WHITE
————————————————-
1.Grading one students
2.Display the Grade of Class
0.Exit
Enter number 1, 2 to continue or 0 to exit:
TASK1: GRADING ONE STUDENT
-Display the message and read the information of one student including, student id, last name, first name, and 3 tests scores
-Create the object of class Student_yourLastname
-Use the object to access the method toString() to display the grade of one student in the requested format
-Open file studentInfo.txt in append mode. Using the object to access method toFile() and write one line about the grade of the student to the file. Close file.
TASK2: DISPLAY THE GRADE OF CLASS
-Open file studentInfo.txt to read
-for each line, split information into studentId, lastname, firstname, percentage and letter grade then display on the screen in the following format:
SU21_StudentGradingApplication_White.java
LIST OF CLASS GRADES – Mc KINLEY WHITE
————————————————-
Student ID: 1212121
Student Name: Kevin Bellamy
Percentage: 91.25
Letter Grade: A
————————————————-
Student ID: 1232123
Student Name: Charles Pescador
Percentage: 82.50
Letter Grade: B
——————————————————-
.
.
————————————————-
Student ID: 7654321
Student Name: Johnson Kennedy
Percentage: 78.28
Letter Grade: C
————————————————-
Student ID: 7655677
Student Name: Jose Munoz
Percentage: 95.27
Letter Grade: A
————————————————-
HOW TO TURN IN THE LAB
You should turn in the following files:(yourLastName should be your last name)
SU2021_LAB6PART1_YourLastName.docx (part 1)
UML Pseudo-code and the output pictures of part2
Student_yourLastName.java
SU2021_StudentGradingApplication_yourLastName.java
Student_yourLastName.class
SU2021_StudentGradingApplication_yourLastName.class
IF YOU GET ANY PROBLEM TO SUBMIT FILEs .class YOU CAN COMPRESS ALL PROJECT INTO ONE FILE .zip or .rar TO UPLOAD TO eCampus
HOW TO GRADE THE LAB
| TOPIC | MAX SCORE |
| Turn in on time | 3 |
| PART 1 | |
| Question1 | 1.5 |
| Question2 | 1 |
| Question3 | 1.5 |
| Question4 | 2 |
| PART 2 | |
| Class data members: last name, first name, student id, array of scores | 1 |
| 2 Constructors | 2 |
| Method calculate the percentage | 1 |
| Method to determine letter grade | 1 |
| Method toString to create the output on screen | 2 |
| Method toFile() to create one line of the output in file | 1 |
| Driver class: | |
| TASK1:Read input from the keyboard, store to array | 2 |
| TASK1:Create the object, | 1 |
| TASK1:Display the result by access method toString() | 1 |
| TASK1:Open file, Write one line to the output file, close file | 1 |
| TASK2: Open file, read file, display on screen in the requested format, close file | 3 |
| Comments, file name at the top | 2 |
| Compile success – qualified the requirement | 3 |
| Total scores | 30 |


0 comments