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: public Student(String id, int score) { /* Student Employee */ } public String getID() { /* returns student's id */ } public int getScore() { /* returns student's score */ } class Roster public Roster(String title) { /* Roster constructor */ } public void add(Student s) { /* Adds student s to the class roster */ } public void display() { /* displays class information i.e. course title,and students' data */ /* (student id, student score) formatted as in the sample output */ } 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: 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 */ }       JAVA PROGRAM:   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 */     } }     import java.util.ArrayList; public class Roster {     private ArrayList list;     private String title;     public Roster(String title) {         /* Roster constructor  */         /* Type your code here */     }     public void add(Student s) {         /* Adds student s to the class roster  */         /* Type your code here */       }     public void display() {         /* displays class information,i,e course title,and students' data   */         /* (student id, student score) formatted as in the sample output    */         /* Type your code here */     }       public int count(int score) {         /* returns number of students in the arrayList students whose score equals   */         /* the method parameter score     */         /* Type your code here */     }     public void dislayScores() {         /* displays scores obtained in the class and their frequencies  */         /* as described in the sample output */         /* Type your code here */              } }

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

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:

public Student(String id, int score) {

/* Student Employee */

}

public String getID() {

/* returns student's id */

}

public int getScore() {

/* returns student's score */

}

  • class Roster

public Roster(String title) {

/* Roster constructor */

}

public void add(Student s) {

/* Adds student s to the class roster */

}

public void display() {

/* displays class information i.e. course title,and students' data */

/* (student id, student score) formatted as in the sample output */

}

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:

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 */

}

 

 

 

JAVA PROGRAM:

 

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 */
    }
}

 

 

import java.util.ArrayList;
public class Roster {

    private ArrayList<Student> list;
    private String title;

    public Roster(String title) {
        /* Roster constructor  */
        /* Type your code here */

    }

    public void add(Student s) {
        /* Adds student s to the class roster  */
        /* Type your code here */
 
    }

    public void display() {
        /* displays class information,i,e course title,and students' data   */
        /* (student id, student score) formatted as in the sample output    */
        /* Type your code here */

    }

 

    public int count(int score) {
        /* returns number of students in the arrayList students whose score equals   */
        /* the method parameter score     */
        /* Type your code here */

    }

    public void dislayScores() {
        /* displays scores obtained in the class and their frequencies  */
        /* as described in the sample output */
        /* Type your code here */
        

    }

}

class Roster
public Roster (String title) {
/* Roster constructor
}
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:
}
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" (1.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:class Roster public Roster (String title) { /* Roster constructor } 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: } 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" (1.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 */
7.6 LAB: Student scores
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
9
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:
public Student (String id, int score) {
/* Student Employee */
}
public String getID () {
}
/* returns student's id */
public int getScore () {
}
/* returns student's score */
Transcribed Image Text:7.6 LAB: Student scores 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 9 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: public Student (String id, int score) { /* Student Employee */ } public String getID () { } /* returns student's id */ public int getScore () { } /* returns student's score */
Expert Solution
Step 1

Program description:

Define a Student class that will get the ID and score of the student.
Define a Roster class that defines the following methods:
Roster (title)
add (student)
Display()
count (score)
displayScores()
In the Main function, define the getInput function:
Get user input for course name and course ID.
Define a Roster object using a name.
Get user inputs for student id and score.
Create a student object using the student information.
Add the Student object to the list.
Return a Roster object.

steps

Step by step

Solved in 2 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