package studentmanagement;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class test {
	static class person {//公共类
			private String name;

			public String getName() {
				return name;
			}

			public void setName(String name) {
				this.name = name;
			}	
		}
	static class Student extends person {
			private String classId;//课程号
			private String subject;//科目
			private String studentClass;//所在班级
			private double score;//分数
			private double showScore;//额外表现分数
			private double endScore;//最终成绩

			public double getScore() {
				return score;
			}

			public void setScore(double score) {
				this.score = score;
			}
			public String getClassId() {
				return classId;
			}

			public void setClassId(String classId) {
				this.classId = classId;
			}

			public String getStudentClass() {
				return studentClass;
			}

			public void setStudentClass(String studentClass) {
				this.studentClass = studentClass;
			}

			public String getSubject() {
				return subject;
			}

			public void setSubject(String subject) {
				this.subject = subject;
			}
			
	        public double getShowScore() {
				return showScore;
			}

			public void setShowScore(double showScore) {
				this.showScore = showScore;
			}

			public double getEndScore() {
				return endScore;
			}

			public void setEndScore(double endScore) {
				this.endScore = endScore;
			}

			//额外表现分
	        public double biaoXianFen(double score, double showScore) {
				  endScore =  score+showScore*0.8;
				return endScore;
	        }
		
		}
	public static void main(String[] args) {
		System.out.println("您好欢迎来到成绩录入系统,请输入录入学生个数");
		Scanner scanner=new Scanner(System.in);//输入流
		  int n= Integer.parseInt(scanner.nextLine());//String强转为一个Int类型
		System.out.println("请输入您将要录入学生的基本信息");
		List<Student> list=new ArrayList<Student>();//List集合,可以录入多个学生的成绩
		for(int i=1;i<=n;i++) {
			Student student = new Student();//实例化,new一个空的学生实体
	
			System.out.println("第"+i+"个学生姓名");
			String name=scanner.nextLine();
			student.setName(name);
			System.out.println("第"+i+"个学生班级");
			String studentClass=scanner.nextLine();
			student.setStudentClass(studentClass);
			System.out.println("第"+i+"个学生课程号");
			String classId=scanner.nextLine();
			student.setClassId(classId);
			System.out.println("第"+i+"个学生科目");
			String subject=scanner.nextLine();
			student.setSubject(subject);
			System.out.println("第"+i+"个学生成绩,实际得分以及额外表现分数");
			double score=scanner.nextDouble();
			double showScore=scanner.nextDouble();
		
			Double endScore = student.biaoXianFen(score, showScore);//返回最终成绩
			student.setScore(score);
			student.setShowScore(showScore);
			student.setEndScore(endScore);
			scanner.nextLine();
			list.add(student);//通过list集合打点调用add方法
		}
		for(Student student:list) {//for遍历,把所有的学生查出来,放入到了a中
			System.out.println("已成功录入学生姓名为:"+student.getName()+"同学,课程号为:  "+student.getClassId()+"科目:  "+student.getSubject()
			+"最终得分成绩为: "+student.getEndScore()+"额外表现分为: "+student.getShowScore());
		}
	}
}
最近下载更多
huangtian  LV3 2023年6月24日
唐俊杰  LV6 2021年12月8日
xuweisong2010  LV27 2021年10月23日
最近浏览更多
sunrandong  LV4 4月29日
XJH939  LV1 3月18日
lironggang  LV38 2月22日
暂无贡献等级
Kaiaahh  LV1 1月2日
lshlsh 2023年12月25日
暂无贡献等级
颜菜菜  LV2 2023年12月19日
xutao0523  LV2 2023年12月18日
COD824  LV1 2023年11月30日
微信网友_6749458052173824 2023年11月24日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友