package fourth;
import java.util.Scanner;
public class Client {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.print("input student count:");
Scanner scn = new Scanner(System.in);
int studentcount = scn.nextInt();
Student students[] = new Student[studentcount];
for (int i = 1; i <= studentcount; i++) {
System.out.print("input no " + i + " student name:");
String name = scn.next();
System.out.print("input no " + i + " student grade:");
int grade = scn.nextInt();
System.out.print("input no " + i + " student course count:");
int coursecount = scn.nextInt();
students[i - 1] = new Student(name, grade, coursecount);
for (int j = 1; j <= coursecount; j++) {
System.out.print("input no " + j + " course name:");
String cname = scn.next();
System.out.print("input no " + j + " course hour:");
int hour = scn.nextInt();
students[i - 1].setCourse(j - 1, cname, hour);
}
}
for (int i = 1; i <= studentcount; i++) {
System.out.println("no " + i + " student information:");
System.out.println(students[i - 1].toString());
System.out.println("courses:");
for (int j = 1; j <= students[i - 1].getCoursecount(); j++) {
System.out.println("(" + j + ")" + students[i - 1].getCourse(j - 1).getName() + ":"
+ students[i - 1].getCourse(j - 1).getHour() + " hour");
}
System.out.println("hours:" + students[i - 1].getHours() + "");
System.out.println();
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
fourth.zip
共3个文件
java:3个
需积分: 0 1 下载量 143 浏览量
2023-10-16
11:28:20
上传
评论
收藏 1KB ZIP 举报
温馨提示
fourth.zip
资源推荐
资源详情
资源评论
收起资源包目录
fourth.zip (3个子文件)
Client.java 1KB
Course.java 557B
Student.java 1KB
共 3 条
- 1
资源评论
通透哥
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功