subject

10.8 zyLab: Print Roster Given a class called Student and a class called Course that contains an ArrayList of Student. Write a method called printRoster() as described below.
Code:
import java. util.*;
import java. io.*;
/
* A list of students in a course
/
public class Course{
/** collection of Students */
private ArrayList roster;
/
Constructor for objects of class Course
/
public Course(){
roster = new ArrayList();
}
/
Use a for-each loop to print students one per line.
Use the provided toString() for Student.
Afterwords, print a final line that displays the
total number of students. For exampple:
First Last 3.2
First Last 2.5
First Last 4.0
Students: 3
/
public void printRoster(){
/** Your code goes here */

}

/
Add a student to the course
/
public void addStudent(Student s){
roster. add(s);
}

/
Main method for testing
/
public static void main(String args[]){
Course cis162 = new Course();
cis162.addStudent(new Student("Henry", "Cabot", 3.2));
cis162.addStudent(new Student("Brenda", "Stern", 3.2));
cis162.addStudent(new Student("Lynda", "Robison", 3.2));
cis162.addStudent(new Student("Jane", "Flynn", 3.2));
cis162.printRoster();
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 23.06.2019 10:30
Would a ps4 wired controller work on an xbox one
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
You know the right answer?
10.8 zyLab: Print Roster Given a class called Student and a class called Course that contains an Ar...
Questions
question
Mathematics, 12.02.2021 02:50
question
Chemistry, 12.02.2021 02:50
question
Mathematics, 12.02.2021 02:50
question
English, 12.02.2021 02:50
question
Mathematics, 12.02.2021 02:50
question
Mathematics, 12.02.2021 02:50
question
Biology, 12.02.2021 02:50
Questions on the website: 13722363