对下列数据进行操作
来源:互联网 发布:软件用户手册英文 编辑:程序博客网 时间:2024/05/22 05:25
对下列数据进行操作:
public class test {public static void main(String[] args) {List<Student> list = new ArrayList<Student>();list.add(new Student("Tom", 18, 100, "class05"));list.add(new Student("Jerry", 22, 70, "class04"));list.add(new Student("Owen", 25, 90, "class05"));list.add(new Student("Jim", 30,80 , "class05"));list.add(new Student("Steve", 28, 66, "class06"));list.add(new Student("Kevin", 24, 100, "class04"));list.add(new Student("Steve", 28, 22, "class06"));Student stu = null;int zf4=0,zf5=0,zf6=0,i=1,j=1,k=1;for (Object object : list) {stu = (Student)object;if(stu.getClasss().equals("class04")){ ++i;zf4 = zf4 + stu.getCj();}else if(stu.getClasss().equals("class05")){ ++j;zf5 = zf5 + stu.getCj();}else if(stu.getClasss().equals("class06")){ ++k;zf6 = zf6 + stu.getCj();}}System.out.println("class4平均分"+(zf4/i) + ",class4平均分"+(zf5/j) + ",class4平均分"+(zf6/k));}}
class4平均分56,class4平均分67,class4平均分29
阅读全文
0 0
- 对下列数据进行操作
- 用批处理对MySQL进行数据操作
- 对表中的数据进行操作
- 3.对数据进行修改操作
- 对远程的数据进行操作
- 数据库对大量数据进行操作
- 多线程对同一数据进行不同操作
- 用批处理对MySQL进行数据操作
- MYSQL对表数据进行操作
- 点击按钮对数据进行操作(1)
- 点击按钮对数据进行操作(2)
- 使用jq对表格数据进行操作
- C#对DataGridView中的数据进行添加、修改、删除操作
- 如何对memcache的数据(key-value)进行遍历操作
- 对DataGridView进行添加、修改、删除数据操作----C#
- 如何对memcache的数据(key-value)进行遍历操作
- C#操作Excel,套用模板并对数据进行分页
- WinForm中利用DataGridView控件对数据进行批量操作
- 十一、Shell test命令
- GSON转换集合
- python简单爬虫(获取图片)
- ProgressBar
- Codeforces Round #433 C
- 对下列数据进行操作
- 关于Lan和Wan网口分配配置
- null排序用法
- taskctl的后台字符界面登录不了解决办法
- Java带样式导出excle(poi)
- PHP的魔术方法
- SpringMVC——处理模型数据
- json时间字符串带T
- Yii