博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
第三次java作业
阅读量:6907 次
发布时间:2019-06-27

本文共 586 字,大约阅读时间需要 1 分钟。

5.1 “学生”类:

² 类名:Student

² 属性:姓名、性别、年龄、学号、5门课程的成绩

² 方法1:在控制台输出各个属性的值、

² 方法2:计算平均成绩

² 方法3:输出各个属性的值和平均成绩

public class student {

String name;
String sex;
int age;
String number;
String score;
int ascore;
public static void main(String[] args){
student a = new student();
a.ascore = (100+99+98+97+96)/5;
a.name = "杨浩亮";
a.sex = "男";
a.age = 20;
a.number = "201801420253";
a.score = "语文:100 英语:99 数学:98 物理:97 化学:96";
System.out.println("名字: "+a.name+" 性别: "+a.sex+" 年龄: "+a.age+" 学号: "+a.number+" 分数: "+a.score+" 平均分: "+(int)a.ascore);
}
}
1635790-20190426103600086-238845731.png

转载于:https://www.cnblogs.com/Mr-YHL98/p/10772874.html

你可能感兴趣的文章
RookeyFrame 信息 常用信息整理
查看>>
面试 笔试
查看>>
PTA循环,函数,数组作业
查看>>
新月集—家庭
查看>>
Gulp 笔记
查看>>
NOI2004郁闷的出纳员
查看>>
scrapy在ubuntu上安装总结
查看>>
Ubuntu抛弃了Untiy转向Gnome,美化之路怎么办?不用怕咱一步一步大变身!
查看>>
Hadoop编译
查看>>
bzoj 5355 kdtree 树链剖分
查看>>
序列化对象
查看>>
ubuntu安装甲骨文最新jdk7
查看>>
AngularJS, Ember.js, Backbone这类新框架与 jQuery的重要区别在哪里?
查看>>
director.js:客户端的路由---简明中文教程
查看>>
Web UI自动化测试中绕开验证码登陆方式浅谈
查看>>
get和load的区别
查看>>
未来的规划
查看>>
一起来学opencv(二):图片通道及色彩空间转化
查看>>
iOS后台运行
查看>>
1632: [Usaco2007 Feb]Lilypad Pond
查看>>