使用this,插入完后,查询成绩,还是初试成绩
package 考核;
import java.util.Scanner;
class lll{
int yw1 = 56; //语文
int sx1 = 66; //数学
int yy1 = 76; //英语
int pjf1; //平均分
int zf1; //总分
public void b() {
System.out.println("欢迎进入人员系统查看");
}
}
//二、成绩
class kkk extends lll{
String km;
int fs;
int zqs;
public void d() {
Scanner c=new Scanner(System.in);
//循环
// while(true){
//选择1:选择目的
System.out.println("查询成绩请按1,添加成绩请按2,修改成绩请按3");
int xz=c.nextInt();
switch(xz) {
case 1:
System.out.println("请选择查询的同学 1.gz 2.czr 3.wj");
String xz1=c.next();
switch(xz1) {
//因为上面用了String xz1=c.next(); ,所以序号加了引号
case "1":
zf1=sx1 +yw1+yy1; //成绩总分
pjf1=(sx1+yw1+yy1)/3; //平均分
System.out.println("贵子成绩如下:数学:"+sx1+",语文:"+yw1+",英语:"+yy1+","+km+":"+fs);
//判断成绩A,B,C级
if(zf1>280) {
System.out.println("平均分为:"+pjf1+",总分为:"+zf1+",成绩为A");
}
else if(280<zf1||zf1>240) {
System.out.println("平均分为:"+pjf1+",总分为:"+zf1+",成绩为B");
}
else {
System.out.println("平均分为:"+pjf1+",总分为:"+zf1+",成绩为C");
}
break;
}
break;
//选择2:选择学生添加科目成绩
case 2:
System.out.println("请选择学生进行成绩添加 1.gz 2.czr 3.wj");
int xz2=c.nextInt();
switch(xz2) {
case 1:
System.out.println("请输入贵子添加的科目");
String km = c.next();
System.out.println("请输入对应的分数");
int fs = c.nextInt();
System.out.println("添加科目成绩为:" + km + ",分数为:" + fs);
this.km = km;
this.fs = fs;
break;
}
}
}
}
//}
//修改成绩
class aaa extends kkk {
public void www() {
Scanner d = new Scanner(System.in);
System.out.println("请选择学生进行成绩修改 1.gz 2.czr 3.wj");
int xz3 = d.nextInt();
switch (xz3) {
case 1:
System.out.println("请贵子输入更改的科目 1.数学 2.英语,3.语文");
int gg = d.nextInt();
switch (gg) {
case 1:
System.out.println("请输入更改后数学成绩");
int zqs = d.nextInt();
int q = sx1 - sx1 + zqs;
this.sx1 = q;
System.out.println("修改后为:数学分数为:" + sx1);
break;
case 2:
System.out.println("请输入更改后英语成绩");
int zqy = d.nextInt();
System.out.println("修改后为:英语分数为:" + zqy);
this.yy1 = zqy;
break;
case 3:
System.out.println("请输入更改后语文成绩");
int zqw = d.nextInt();
System.out.println("修改后为:语文分数为:" + zqw);
this.yw1 = zqw;
break;
}
System.out.println("贵子最终成绩如下:数学:" + sx1 + ",语文:" + yw1 + ",英语:" + yy1);
break;
}
}
}
public class v1 {
public static void main(String[]args) {
//实例化,调用方法
lll l=new lll();
l.b();
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
while (true){
if (s.equals("9")){
break;
}else {
kkk k=new kkk();
k.d();
aaa a = new aaa();
a.www();
}
}
}
}