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 18:30
Technician a says that a shop towel should never be used to clean around the flange area before replacing an automatic transmission filter. technician b says that a dimpled transmission fluid pan can be repaired. who is right
Answers: 3
question
Computers and Technology, 22.06.2019 19:30
Avariable definition defines the name of a variable that will be used in a program, as well as
Answers: 3
question
Computers and Technology, 23.06.2019 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
This isn't about school but every time it tells me to watch an ad to unlock the answer to a question it prompts a survey and it just keeps loading. so i haven't been able to get answers for my tests in like a week.
Answers: 2
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, 16.06.2020 22:57
Questions on the website: 13722360