资源简介
ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8ssd3 practical quiz 8
代码片段和文件信息
import java.util.*;
/**
* This class contains methods to process array lists of {@link Student}
* objects.
*
* @author autor name
* @version 1.0.0
* @see Student
* @see ArrayList
*/
public class StudentArrayList {
/**
* Returns an array list with three elements.
*
* @param first a Student
object.
* @param second a Student
object.
* @param third a Student
object.
* @return an array list with the objects first
* second
and third
*/
public static ArrayList makeArrayList(
Student first
Student second
Student third) {
ArrayList student=new ArrayList();
student.add(first);
student.add(second);
student.add(third);
return student;
}
/**
* Returns an array list with the same elements of the specified array
* arranged in the same order.
*
* @param array an array with Student
objects .
* @return an array list with the same elements of the specified array
* arranged in the same order
*/
public static ArrayList makeArrayListFromArray(Student[] array) {
ArrayList student=new ArrayList();
for(Student std:array){
student.add(std);
}
return student;
}
/**
* Returns true
if the specified array list contains a
* student whose id matches the specified ID.
*
* @param arrayList an array list of Student
objects.
* @param id a student ID.
* @return true
if the specified array list contains a
* student whose ID matches the specified ID;
* false
otherwise.
*/
public static boolean hasStudent(
ArrayList arrayList
int id) {
for(Student std:arrayList){
if(std.getId()==id)
return true;
}
return false;
}
/**
* Returns the number of students in the specified array list whose
* grade is greater than or equal to the specified grade.
*
* @param arrayList an array list of Student
objects.
* @param grade a grade.
* @return the number of students in the specified array list whose
* grade is greater than or equal to the specified grade.
*/
public static int countGradeGreaterOrEqual(
ArrayList arrayList
int grade) {
int count=0;
for(Student std:arrayList){
if(std.getGrade()>=grade)
++count;
}
return count;
}
/**
* Returns the smallest grade of the students in the specified array list.
*
* This method assumes that the array list is not empty.
*
* @param arrayList an array list of Student
objects.
* @return the smallest grade of the students
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2010-11-30 22:26 practical quiz 8\
目录 0 2010-11-30 22:26 practical quiz 8\student-files\
文件 1088 2006-01-11 06:07 practical quiz 8\student-files\Student.class
文件 2512 2005-12-03 00:19 practical quiz 8\student-files\Student.java
文件 1382 2006-01-11 06:07 practical quiz 8\student-files\StudentArrayList.class
文件 4392 2005-12-01 01:44 practical quiz 8\student-files\StudentArrayList.java
文件 6463 2006-01-11 06:07 practical quiz 8\student-files\TestStudentArrayList.class
文件 9785 2005-12-01 01:44 practical quiz 8\student-files\TestStudentArrayList.java
文件 5373 2010-11-30 22:24 practical quiz 8\StudentArrayList.java
- 上一篇:基于proteus的8086和8253
- 下一篇:基于单片机的FSK调制器设计
相关资源
- SSD7 所有习题答案完美版
- storyline 2 Quizmaker13测试题批量导入模板
- ssd3 Practical Quiz 5 答案
- SSD3所有exercise答案
- 新版ssd3 quiz 3
- ssd7 exam2 Practical + choice
- SSD3 exercise5 答案 保证正确
- ssd3 的所有的exercise答案 和exam 答案
- SSD3 exercise6 的答案
- Machine Learning Essentials: Practical Guide i
- SSD3 所有练习答案
- A Practical Guide to Linux Commands Editors an
- 英文原版-Practical Information Security Ma
- SSD3-Exercise7
- Practical Optimization:Algorithms and Engine
- Practical Programming In Tcl And Tk 4th Editio
- NGINX:: A Practical Guide To High Performance
- Practical_Lessons_from_Predicting_Clicks_on_Ad
- ssd3 exercise+quiz+选择题答案全集
- SSD3答案完整版
- UIPath Online Quiz理论考试题+答案.docx
评论
共有 条评论