Write a program that reads a course's title and enrolled student information (student id, student score) and displays the input data followed by the frequency of each score in the course. The end of input is indicated by letter q on the last line For example, for the input: 10 90 12 50 17 85 15 90 42 75 20 90 30 75 78 50 61 50 21 85 22 50 q The output is: COP 3804 class list. 10 90 12 50 17 85 15 90 42 75 20 90 30 75 78 50 61 50 21 85 22 50 COP 3804 class scores 90 3 50 4 85 2 75 2 Given classes: • class Student represents a student • class Roster represents a course class LabProgram contains the main method that reads course data (i.e. course title and students' information), creates a Roster object with the input data and produces the output by calling relevant methods of the Roster object Your task is to complete the following methods: class Student:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

import java.util.Scanner;
 
public class LabProgram {

   public static Roster getInput(){
        /* Reads course title, creates a roster object with the input title. Note that    */
        /* the course title might have spaces as in "COP 3804" (i.e. use nextLine)   */
        /* reads input student information one by one, creates a student object */
        /* with each input student and adds the student object to the roster object */
        /* the input is formatted as in the sample input and is terminated with a "q" */
        /* returns the created roster         */
        
        /* Type your code here */
 
    }
    
    public static void main(String[] args) {

        Roster course = getInput();
        course.display();
        course.dislayScores();
    }
}

 

public class Student {

    String id;
    int score;

    public Student(String id, int score) {
        /* Student Employee  */
        /* Type your code here */
        
    }

    public String getID() {
        /* returns student's id */
        /* Type your code here */

    }

    public int getScore() {
        /* returns student's score */
        /* Type your code here */
    }
}

 

 

public Student (String id, int score) {
/* Student Employee
}
public String getID () {
}
public int getScore () {
class Roster
}
/* returns student's id */
public Roster (String title) {
/* Roster constructor
}
/* returns student's score */
public void add (Student s) {
}
public void display() {
/* displays class information i.e. course title, and students' data
/* (student id, student score) formatted as in the sample output
}
/* Adds students to the class roster */
public int count (int score) {
/* returns number of students in the roster whose score equals
/* the method parameter score
*/
public void dislayScores () {
/* displays scores obtained in the class and their frequencies */
/*as described in the sample output */
}
• class LabProgram:
de /
4/
public static Roster getInput () {
/* Reads course title, creates a roster object with the input title. Note that
/* the course title might have spaces as in "COP 3804" (i.e. use nextLine)
/* reads input student information one by one, creates a student object */
/* with each input student and adds the student object to the roster object */
/* the input is formatted as in the sample input and is terminated with a "q" */
/* returns the created roster
Transcribed Image Text:public Student (String id, int score) { /* Student Employee } public String getID () { } public int getScore () { class Roster } /* returns student's id */ public Roster (String title) { /* Roster constructor } /* returns student's score */ public void add (Student s) { } public void display() { /* displays class information i.e. course title, and students' data /* (student id, student score) formatted as in the sample output } /* Adds students to the class roster */ public int count (int score) { /* returns number of students in the roster whose score equals /* the method parameter score */ public void dislayScores () { /* displays scores obtained in the class and their frequencies */ /*as described in the sample output */ } • class LabProgram: de / 4/ public static Roster getInput () { /* Reads course title, creates a roster object with the input title. Note that /* the course title might have spaces as in "COP 3804" (i.e. use nextLine) /* reads input student information one by one, creates a student object */ /* with each input student and adds the student object to the roster object */ /* the input is formatted as in the sample input and is terminated with a "q" */ /* returns the created roster
Write a program that reads a course's title and enrolled student information (student id, student score) and displays the input data followed
by the frequency of each score in the course. The end of input is indicated by letter q on the last line For example, for the input:
10 90
12 50
17 85
15 90
42 75
20 90
30 75
78 50
61 50
21 85
22 50
q
The output is:
COP 3804 class list
10 90
12 50
17 85
15 90
42 75
20 90
30 75
78 50
61 50
21 85
22 50
COP 3804 class scores
90 3
50
4
85
2
75
2
Given classes:
ent represents a lent
• class Roster represents a course
• class LabProgram contains the main method that reads course data (i.e. course title and students' information), creates a Roster
object with the input data and produces the output by calling relevant methods of the Roster object
Your task is to complete the following methods:
• class Student:
Transcribed Image Text:Write a program that reads a course's title and enrolled student information (student id, student score) and displays the input data followed by the frequency of each score in the course. The end of input is indicated by letter q on the last line For example, for the input: 10 90 12 50 17 85 15 90 42 75 20 90 30 75 78 50 61 50 21 85 22 50 q The output is: COP 3804 class list 10 90 12 50 17 85 15 90 42 75 20 90 30 75 78 50 61 50 21 85 22 50 COP 3804 class scores 90 3 50 4 85 2 75 2 Given classes: ent represents a lent • class Roster represents a course • class LabProgram contains the main method that reads course data (i.e. course title and students' information), creates a Roster object with the input data and produces the output by calling relevant methods of the Roster object Your task is to complete the following methods: • class Student:
Expert Solution
Step 1

Program Description:

  • Define the Student class which gets the id and score of the student.
  • Define the Roster class which defines the following methods:
    • Roster(title)
    • add(Student)
    • display()
    • count(score)
    • displayScores()
  • In the Main function, define the getInput function:
    • Get the user input for course name and course id.
    • Define a Roster object using the title.
    • Get the user inputs for student id and scores.
    • Create a Student object using the student information.
    • Add the Student object to the Roster.
    • Return the Roster object.

 

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Time complexity
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education