编写一个程序实现学员成绩管理

该博客介绍如何编写一个程序来管理学员的成绩,包括学员的学号、姓名和三门课程的成绩。通过面向对象的方式,定义学员类来保存成员变量,并实现录入、显示、删除学员信息,以及统计学生成绩的功能。博主强调了使用setter和getter方法以及this关键字的重要性。
摘要由CSDN通过智能技术生成

编写一个程序实现学员成绩管理

成员变量(属性):
  • 每个学员包括3门课的成绩,
  • 包括学号、姓名

方法:

  • 根据对学员的平均成绩进行分析:
  • 利用对象来保存每个学员的信息(根据已学习到的面向对象知识来写)
  • 单个学员信息的录入;
  • 显示所有学员信息;
  • 删除学生;
  • 统计某个学生三门课总分 统计某个学生三门课平均分
分析题目

我们要做的:

  1. 首先要对学生的成员变量放在单独一个类中单独保存
  2. 将要使用的增删改查的方法写在另一个的类中.
  3. 将要传入的数据和运行入口写在一个方法中.

第一步:

public class Student_3 {
   
	int number;
	String name;
	int math;
	int chinese;
	int english;
	int sum = math + chinese + english;
	int average = (math + chinese + english) / 3;

	public Student_3(int number, String name, int math, int chinese, int english) {
   
		this.number = number;
		this.name = name;
		this.math = math;
		this.chinese = chinese;
		this.english = english;
		this.average = (math + chinese + english) / 3;
		this.sum = math + chinese + english;
	}

	public int getNumber() {
   
		return number;
	}

	public void setNumber(int number) {
   
		this.number = number;
	}

	public String getName() {
   
		return name;
	}

	public void setName(String name) {
   
		this.name = name;
	}

	public int getMath() {
   
		return math;
	}

	public void setMath(int math) {
   
		this.math = math;
	}

	public int getChinese() {
   
		
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值