(1)声明 Student 类,其成员变量包含学号、姓名、数学成绩和计算机成绩。要求:该类的构造方法中用到 this 关键字;对于每一个成员变量,都
要有对应的 set 方法和 get 方法来设置成员变量的值和获取成员变量的值。还要有一个 void print()方法,功能是输出成员变量的信息。
(2)在主类的 main 方法中,创建学生类的数组,从键盘上输入若干学生的信息,之后输出这些学生的信息;将学生信息分别按照两门课 程的成绩
升序排序。(画出内存分配图,手工画图拍照即可。)
JAVA程序设计的实验问题
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- CSDN专家-sinJack 2021-10-17 15:02关注
class Student //定义学生类 { private String stuno; private String name; private float math; private float computer; public Student() { } public Student(String stuno, String name, float math, float computer) { this.setStuno(stuno); this.setName(name); this.setMath(math); this.setComputer(computer); } public void setStuno(String s) { stuno = s; } public void setName(String n) { name = n; } public void setMath(float m) { math = m; } public void setComputer(float c) { computer = c; } public String getStuno() { return stuno; } public String getName() { return name; } public float getMath() { return math; } public float getcomputer() { return computer; } public void print(){ System.out.println(stuno+","+name","+math+","+computer); } public class e1 { public static void main(String[] args) { } }
解决 无用评论 打赏 举报
悬赏问题
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
- ¥15 错误 LNK2001 无法解析的外部符号
- ¥50 安装pyaudiokits失败
- ¥15 计组这些题应该咋做呀
- ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
- ¥15 让node服务器有自动加载文件的功能
- ¥15 jmeter脚本回放有的是对的有的是错的
- ¥15 r语言蛋白组学相关问题
- ¥15 Python时间序列如何拟合疏系数模型