Student Grade Task 1 and 2 Solved

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: zip zip solution files instantly, after Payment

Securely Powered by: Secure Checkout

Description

5/5 - (2 votes)

The given program ,(ProjectOld File), performs statistical analysis of scores for a class of students by printing student scores and calculate the lowest, highest, & average score of each quiz for every student. The class may have up to 40 students. There are five quizzes during the term. Each student is identified by a four-digit student ID number.The new project(Project Main) must be created on top of this project(ProjectOld File)
Task I:
create a separate serialized file using ObjectOutputStream for each student. File should contain student’s score and statistics for entire class. Using debug mode (with Debug flag) print the contents of the serialized file.
Class StudentGrade
Class Statistics
Class Student
Steps for this task:
Write a serialized file for each student.
Create a class – StudentGrade implements Serializable
Instance variables
Student <– One student
Statistics
print() –
prints properties of both Student and Statistics.
(complete this given Class:
package db;
import java.io.*;
public class StudentGrade implements Serializable{
private Student stu;
private Statistics stat;
public StudentGrade(Student stu, Statistics stat) {
this.stu = stu;
this.stat = stat;
}
void print(boolean debug)
{
if(debug==true)
{
//call the print methods of classes used for instance variables.
}
}
//add any other methods as you see fit.
}FileIO Class-
WriteStudentGradetoDisk(StudentGrade a1)
//Write the object to disk.
//Use studentid in StudentGrade as filename.dat – for e.g. “1234.dat”
ReadStudentGradetoDisk(String filename)Driver Class-
Create an array of StudentGrades – and write to disk
Fileio f1 = new FileIO();
StudentGrade a1[] = new StudentGrade[40];
Loop
Build StudentGrade objects using StudentGrade constructor.
f1.WriteStudentGradetoDisk(a1[i]);
End Loop
read each file – print the score.Using debug mode (with Debug flag) print the contents of the serialized file.Create and implement an interface to:
Print student statistics.
Print scores for a given student id.
implement the Debug flag globally
Use an abstract class to implement all the methods declared in an interface.
When printing a serialized file it should look like this:Stud Q1 Q2 Q3 Q4 Q5
1234 78 83 87 91 86
High Score 78 89 93 91 86
Low Score 67 77 84 82 71
Average 73.4 83.0 88.2 86.6 78.6a) naming convention for each filename.
studentid.ser or studentid.dat
b) method for writing and reading serialized file should be in FileIO or Util.
c) When implementing Serialization – implement Serializable interface in following classes
– StudentGrade
– Student
– Statistics
Designing main()
1. Instantiate StudentGrade.
File has already been read (n records read (upto 40)).
2. Prompt a user – to deliver all grades – (n serialized files are written to disk).
When you serialize – good idea to print before serializing and after serializing – good way to confirm – with DEBUG flag turned on
3. Testing part 1 –
Different # of records in the file.
Boundary condition –
Up to 40 records
41 records – > 40 is ignored.
Header –
1 record
15 records
39 records <– Boundary condition
40 records <– Boundary condition
..Should be able to run both.
Task II:
****Working with Interfaces******
Create and implement an interface to:
Print student statistics.
Print scores for a given student id.
implement the Debug flag globally
Use an abstract class to implement all the methods declared in an interface.
Create and implement an interface to:
Print student statistics.
Create and implement an interface to:
Print student statistics.
Print scores for a given student id.
implement the Debug flag globally
Use an abstract class to implement all the methods declared in an interface.
Print scores for a given student id.
implement the Debug flag globally
Use an abstract class to implement all the methods declared in an interface.
given data:
1234 052 007 100 078 034
2134 090 036 090 077 030
3124 100 045 020 090 070
4532 011 017 081 032 077
5678 020 012 045 078 034
6134 034 080 055 078 045
7874 060 100 056 078 078
8026 070 010 066 078 056
9893 034 009 077 078 020
1947 045 040 088 078 055
2877 055 050 099 078 080
3189 022 070 100 078 077
4602 089 050 091 078 060
5405 011 011 000 078 010
6999 000 098 089 078 020

  • StudentGrade2.zip
  • StudentGrade.zip