Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a student gradebook on java. Use buffered reader/string tokenizer IF t

ID: 3832600 • Letter: I

Question

Implement a student gradebook on java. Use buffered reader/string tokenizer IF the user has to enter input. Here's the question:

Also,StudentType.java file that was initially stated in the question has the following code:

In lab 8 you will be writing a class that uses the StudentType class ou will find Student Typejava a good starting place). The new class is a "roster Type" needed to implement a Student Gradebook to be used to grade a course. Your portion of the program will need to maintain information for a maximum class size of 20 students. The interface specification is: class rosterType f constructor to initialize the class roster to an empty state ready to receive new students to a maximum of 20 students. public roster Type Tells whether or not the class is empty or full public boolean is full public boolean isEmpty Add a tudent o the class in SID sorted order If the class is full do nothing, discard the student. public void addstudent Student Type newStudent Return the student specified by the student id. If no student matches the id, return an empty student. public Student Type findstudent tring sid) tostring method returns the entir class as a st ring with tabs between fields of a student and newlines between students public String tostring print By Grade prints out the entire class sorted by the total grade each student has earned. Additionally, the method will output the mean score the average score and the median score the middle value or the average of the two middle values in an even number of scores). boobie tofuhead 878-5 7051 96 stinky hanker 175-12-7353 91,

Explanation / Answer

studentType.java

/**
*/
public class StudentType {

    private String Fname;
    private String Lname;
    private String SID;
    private double [] Scores;
    private char Letter;
    private static int MaxScores = 10;

        // initialize all String attributes to an empty String,
        // initialize all numeric values to zero.
    public StudentType () {
        Fname = "";
        Lname = "";
        SID = "";
        Scores = new double [MaxScores];
        for (int i = 0; i < MaxScores; ++i)
            Scores [i] = 0;
    }
    public StudentType (String lname, String fname, String sid) {
        Fname = fname;
        Lname = lname;
        SID = sid;
        Scores = new double [MaxScores];
        for (int i = 0; i < MaxScores; ++i)
            Scores [i] = 0;
    }

        // set and get Last Name
    public void setLname(String lname) {
        Lname = lname;
    }
    public String getLname() {
        return (Lname);
    }

        // set and get First Name
    public void setFname(String fname) {
        Fname = fname;
    }
    public String getFname() {
        return (Fname);
    }

        // set and get SID
    public void setSID(String sid) {
        SID = sid;
    }
    public String getSID() {
        return (SID);
    }
        // get a formatted SID
    public String getFormatedSID() {
        StringBuffer tSID = new StringBuffer (SID);

        if (SID.length () != 0) {
            tSID.insert (5, '-');
            tSID.insert (3, '-');
        }
        return tSID.toString ();
    }
      
        // set and get Score
    public void setScore(int quizNum, double score) {
        if (quizNum > 0 && quizNum <= MaxScores)
            Scores [quizNum - 1] = score;
    }
    public double getScore(int quizNum) {
        double rScore = 0.0;
        if (quizNum > 0 && quizNum <= MaxScores)
            rScore = Scores [quizNum - 1];
        return rScore;
    }

    public double getTotal() {
        double sum = 0;
        for (int i = 0; i < MaxScores; ++i)
            sum += Scores [i];
        return sum;
    }
        // set and get letter grade for the current quiz
   public void setLetter (char letterGrade) {
        Letter = letterGrade;
   }
   public char getLetter () {
        return Letter;
   }

        // get First Name Last Name formatted ID as a String
        // there will be a space between the first name and the
        // last name and a tab between the last name and the ID
    public String toString() {
        return Fname + " " + Lname + " " + getFormatedSID ();
    }
}


rosterType.java


import java.util.*;

public class rosterType {
   private int index;
   private StudentType[] students;
   private StatPackage scores;

   public rosterType() {
       index = 0;
       students = new StudentType[20];
       scores = new StatPackage();
   }

   public boolean isFull() {
       return index == 20;
   }

   public boolean isEmpty() {
       return index == 0;
   }

   public void addStudent(StudentType newStudent) {
       if(index == 20) {
           return;
       }
       students[index++] = newStudent;
   }

   public StudentType findStudent(String sid) {
       StudentType s;
       for(int i = 0; i < index; i++) {
           s = students[i];
           if(s.getSID() == sid) {
               return s;
           }
       }
       return new StudentType();
   }

   public String toString() {
       StudentType[] studentCopy = sortCopy(students, index, new Comparator<StudentType>() {
           public int compare(StudentType s1, StudentType s2) {
               return s1.getSID().compareTo(s2.getSID());
           }
       });
       StringBuffer sb = new StringBuffer();
       for(StudentType s : studentCopy) {
           sb.append(s.toString());
           sb.append(" ");
       }
       return sb.toString();
   }

   public void printByGrade() {
       if(isEmpty()) {
           System.out.println("The class is empty");
           return;
       }
       StudentType[] studentCopy = sortCopy(students, index, new Comparator<StudentType>() {
           public int compare(StudentType s1, StudentType s2) {
               //sort in descending order
               return (int) (s2.getTotal()/ - s1.getTotal());
           }
       });
       for(StudentType s : studentCopy) {
           scores.insert(s.getTotal());
           System.out.printf("%s %2d%n", s, s.getTotal());
       }
       System.out.printf("Mean: %2d%n", scores.Mean());
       System.out.printf("Median: %2d%n", scores.Median());
   }

   //length parameter exists so you can range over the results
   //if passed a non-full array
   public <T> T[] sortCopy(T[] arr, int length, Comparator<T> comp) {
       T[] copy = Arrays.copyOf(arr, length);
       Arrays.sort(copy, comp);
       return copy;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote