码迷,mamicode.com
首页 > 其他好文 > 详细

课堂测试

时间:2019-09-13 01:12:55      阅读:69      评论:0      收藏:0      [点我收藏+]

标签:测试   输入数据   net   setname   int   生成   for   ack   界面   

package 测试;
import java.util.Scanner;
class  ScoreInformation  {
 private String stunumber;
 private String name;
 private double mathematicsscore;
 private double englishiscore;
 private double networkscore;
 private double databasescore;
 private double softwarescore;
 public ScoreInformation() {
  super();
 }
 public ScoreInformation(String stunumber,String name,double mathematicsscore,double englishiscore,double  networkscore,double databasescore,double softwarescore ) {
  this.stunumber=stunumber;
  this.name=name;
  this.mathematicsscore=mathematicsscore;
  this.englishiscore=englishiscore;
  this.networkscore=networkscore;
  this.databasescore=databasescore;
  this.softwarescore=softwarescore;
 }
 public String getStunumber() {
  return stunumber;
 }
 public void setStunumber(String stunumber) {
  this.stunumber=stunumber;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name=name;
 }
 public double getMathematicsscore() {
  return mathematicsscore;
 }
 public void setMathematicsscore(double mathematicsscore) {
  this.mathematicsscore=mathematicsscore;
 }
 public double getEnglishiscore() {
  return englishiscore;
 }                                                                        
 public void setEnglishiscore(double englishiscore) {
  this.englishiscore= englishiscore;
 }                                                   
 public double getNetworkscore() {
  return networkscore;
 }
 public void setNetworkscore(double networkscore) {
  this.networkscore=networkscore;
 }
 public double getDatabasescore() {
  return databasescore;
 }
 public void setDatabasescore(double databasescore) {
  this.databasescore=databasescore;
 }
 public double getSoftwarescore() {
  return softwarescore;
 }
 public void setSoftwarescore(double softwarescore) {
  this.softwarescore=softwarescore;
 }
 
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
public class ScoreManagement {
 static Scanner sc=new Scanner(System.in);
 static ScoreInformation[]a=new ScoreInformation[5];
 static void stu() {
  a[0]=new ScoreInformation("20183788","刘志霄",0,0,0,0,0);
  a[1]=new ScoreInformation("20183789","小米",0,0,0,0,0);
  a[2]=new ScoreInformation("20183790","小红",0,0,0,0,0);
  a[3]=new ScoreInformation("20183791","小黑",0,0,0,0,0);
  a[4]=new ScoreInformation("20183792","小白",0,0,0,0,0);
 }
 public static void main(String[] args) {
  stu();
  zhuye();
  
 }
 static void zhuye(){
   for(;;) {
       System.out.println("***********************************************************");
       System.out.println("              石家庄铁道大学软件工程系 ");
       System.out.println("              学生学籍管理系统 2019 版 ");
       System.out.println("*********************************************************** ");
       System.out.println("              1、 学生考试成绩录入 ");
       System.out.println("              2、 学生考试成绩修改 ");
       System.out.println("              3、 计算学生成绩绩点 ");
       System.out.println("              4、 退出学籍管理系统 ");
       System.out.println("********************************************************** ");
       int m=sc.nextInt();
       switch(m) {
       case 1:
        xuehao();
        luru();
        
         break;
       case 2:
        xiugai();
        gaicuo();
        break;
       case 3:
        jidian();
        jisuan();
        break;
       case 4:
         System.out.println("***********************************************************");
            System.out.println("    谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
            System.out.println("                       制作人:刘志霄 ");
            System.out.println("*********************************************************** ");
        break;
       default:
        System.out.println("错误");
        break;
       
       }
      }
 }
 static void xuehao() {
  System.out.println("***********************************************************");
  System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
  System.out.println("             学生考试成绩录入");
  System.out.println("***********************************************************");
  System.out.println("             请输入学生学号 ");
  System.out.println("**********************************************************");
 }
 static void luru() {
  int i;
  String n1=sc.next();
  for(i=0;i<5;i++) {
   if(n1.equals(a[i].getStunumber())) {
    System.out.println("***********************************************************");
    System.out.println("     石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
    System.out.println("                  学生考试成绩录入界面 ");
    System.out.println("***********************************************************");
    System.out.println("                   学生学号:"+a[i].getStunumber());
    System.out.println("                    学生姓名:"+a[i].getName());
     System.out.println("                 请输入高等数学成绩:");
     a[i].setMathematicsscore(sc.nextDouble());
     System.out.println("***********************************************************");
     System.out.println("                 请输入大学英语成绩:");
     a[i].setEnglishiscore(sc.nextDouble());
     System.out.println("***********************************************************");
     System.out.println("                 请输入计算机成绩:");
     a[i].setNetworkscore(sc.nextDouble());
     System.out.println("***********************************************************");
     System.out.println("                 请输入数据库成绩:");
     a[i].setDatabasescore(sc.nextDouble());
     System.out.println("***********************************************************");
     System.out.println("                 请输入软件工程成绩:");
     a[i].setSoftwarescore(sc.nextDouble());
    System.out.println("***********************************************************");
    System.out.println("        石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
    System.out.println("                       学生考试成绩录入 ");
    System.out.println("*********************************************************** ");
    System.out.println("                   学生学号"+a[i].getStunumber());
    System.out.println("                    学生姓名"+a[i].getName());
    System.out.println("                   1,高等数学成绩"+a[i].getMathematicsscore());
    System.out.println("                   2,大学英语成绩"+a[i].getEnglishiscore());
    System.out.println("                  3,计算机网络成绩"+a[i].getNetworkscore());
    System.out.println("                    4 ,数据库成绩"+a[i].getDatabasescore());
    System.out.println("                   5,软件工程成绩"+a[i].getSoftwarescore());
    System.out.println(                    "该学生成绩已录入完毕,是否提交(Y/N)");
    System.out.println("**********************************************************");
   }
   else {
    System.out.println("该学号不存在");
    xuehao();
    luru(); 
    }
    String n2=sc.next();
    if(n2.equals("Y")) {
     zhuye();     
    }
    if(n2.equals("y")) {
     zhuye();     
    }
    if(n2.equals("N")) {
     a[i].setMathematicsscore(0);
     a[i].setEnglishiscore(0);
     a[i].setNetworkscore(0);
     a[i].setDatabasescore(0);
     a[i].setSoftwarescore(0);
     xuehao();
     luru();     
    }
    if(n2.equals("n")) {
     a[i].setMathematicsscore(0);
     a[i].setEnglishiscore(0);
     a[i].setNetworkscore(0);
     a[i].setDatabasescore(0);
     a[i].setSoftwarescore(0);
     xuehao();
     luru();     
    }
 }
 }
  
  
 static void xiugai(){
  System.out.println("***********************************************************");
  System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
  System.out.println("             学生考试成绩修改界面");
  System.out.println("***********************************************************");
  System.out.println("             请输入学生学号 ");
  System.out.println("**********************************************************");  
 }
 static void gaicuo() {
  int j;
  String n3=sc.next();
  for(j=0;j<5;j++)
   if(n3.equals(a[j].getStunumber())) {
    System.out.println("***********************************************************");
    System.out.println("        石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
    System.out.println("                       学生考试成绩录入 ");
    System.out.println("*********************************************************** ");
    System.out.println("                   学生学号"+a[j].getStunumber());
    System.out.println("                    学生姓名"+a[j].getName());
    System.out.println("                   1,高等数学成绩"+a[j].getMathematicsscore());
    System.out.println("                   2,大学英语成绩"+a[j].getEnglishiscore());
    System.out.println("                  3,计算机网络成绩"+a[j].getNetworkscore());
    System.out.println("                    4 ,数据库成绩"+a[j].getDatabasescore());
    System.out.println("                   5,软件工程成绩"+a[j].getSoftwarescore());
    System.out.println("***********************************************************");
    int k=sc.nextInt();
    switch(k) {
    case 1:
     System.out.println("***********************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩修改界面");
     System.out.println("***********************************************************");
     System.out.println("                   学生学号"+a[j].getStunumber());
     System.out.println("                    学生姓名"+a[j].getName());
     System.out.println("                 请输入修改后的高等数学成绩");
     System.out.println("***********************************************************");
     a[j].setMathematicsscore(sc.nextDouble());
     break;
    case 2:
     System.out.println("***********************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩修改界面");
     System.out.println("***********************************************************");
     System.out.println("                   学生学号"+a[j].getStunumber());
     System.out.println("                    学生姓名"+a[j].getName());
     System.out.println("                 请输入修改后的大学英语成绩");
     System.out.println("***********************************************************");
     a[j].setEnglishiscore(sc.nextDouble());
     break;
    case 3:
     System.out.println("***********************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩修改界面");
     System.out.println("***********************************************************");
     System.out.println("                   学生学号"+a[j].getStunumber());
     System.out.println("                    学生姓名"+a[j].getName());
     System.out.println("                 请输入修改后的计算机网络成绩");
     System.out.println("***********************************************************");
     a[j].setNetworkscore(sc.nextDouble());
     break;
    case 4:
     System.out.println("***********************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩修改界面");
     System.out.println("***********************************************************");
     System.out.println("                   学生学号"+a[j].getStunumber());
     System.out.println("                    学生姓名"+a[j].getName());
     System.out.println("                 请输入修改后的数据库成绩");
     System.out.println("***********************************************************");
     a[j].setDatabasescore(sc.nextDouble());
     break;
    case 5:
     System.out.println("***********************************************************");
     System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
     System.out.println("             学生考试成绩修改界面");
     System.out.println("***********************************************************");
     System.out.println("                   学生学号"+a[j].getStunumber());
     System.out.println("                    学生姓名"+a[j].getName());
     System.out.println("                 请输入修改后的软件工程成绩");
     System.out.println("***********************************************************");
     a[j].setSoftwarescore(sc.nextDouble());
     break;
    }
    System.out.println("***********************************************************");
    System.out.println("        石家庄铁道大学软件工程系学生学籍管理系统 2019 版 ");
    System.out.println("                       学生考试成绩录入 ");
    System.out.println("*********************************************************** ");
    System.out.println("                   学生学号"+a[j].getStunumber());
    System.out.println("                    学生姓名"+a[j].getName());
    System.out.println("                   1,高等数学成绩"+a[j].getMathematicsscore());
    System.out.println("                   2,大学英语成绩"+a[j].getEnglishiscore());
    System.out.println("                  3,计算机网络成绩"+a[j].getNetworkscore());
    System.out.println("                    4 ,数据库成绩"+a[j].getDatabasescore());
    System.out.println("                   5,软件工程成绩"+a[j].getSoftwarescore());
    System.out.println(                    "该学生成绩已修改完毕,是否提交(Y/N)");
    System.out.println("*********************************************************** ");
    String n4=sc.next();
    if(n4.equals("Y")) {
     zhuye();     
    }
    if(n4.equals("y")) {
     zhuye();     
    }
    if(n4.equals("N")) {
     a[j].setMathematicsscore(0);
     a[j].setEnglishiscore(0);
     a[j].setNetworkscore(0);
     a[j].setDatabasescore(0);
     a[j].setSoftwarescore(0);
     xiugai();
     gaicuo();
    }
    if(n4.equals("n")) {
     a[j].setMathematicsscore(0);
     a[j].setEnglishiscore(0);
     a[j].setNetworkscore(0);
     a[j].setDatabasescore(0);
     a[j].setSoftwarescore(0);
     xiugai();
     gaicuo();
    }
   } 
   else {
    System.out.println("该学号不存在");
    xiugai();
    gaicuo();
   }
 }
 static void jidian(){
  System.out.println("***********************************************************");
  System.out.println("    石家庄铁道大学软件工程系学生学籍管理系统2019版");
  System.out.println("             学生考试成绩绩点计算界面");
  System.out.println("***********************************************************");
  System.out.println("             请输入学生学号 ");
  System.out.println("**********************************************************");  
 }
 static void jisuan() {
  int l;
  double l1,l2 = 0,l3,l4,l5;
  String n5=sc.next();
  for(l=0;l<5;l++)
   if(n5.equals(a[l].getStunumber())) {
    if(a[l].getMathematicsscore()>=90)
      l1=4.0;
     else if(a[l].getMathematicsscore()>=85&&a[l].getMathematicsscore()<=89.9)
      l1=3.7;
     else if(a[l].getMathematicsscore()>=82&&a[l].getMathematicsscore()<=84.9)
      l1=3.3;
     else if(a[l].getMathematicsscore()>=78&&a[l].getMathematicsscore()<=81.9)
      l1=3.0;
     else if(a[l].getMathematicsscore()>=75&&a[l].getMathematicsscore()<=77.9)
      l1=2.7;
     else if(a[l].getMathematicsscore()>=72&&a[l].getMathematicsscore()<=74.9)
      l1=2.3;
     else if(a[l].getMathematicsscore()>=68&&a[l].getMathematicsscore()<=71.9)
      l1=2.0;
     else if(a[l].getMathematicsscore()>=66&&a[l].getMathematicsscore()<=67.9)
      l1=1.7;
     else if(a[l].getMathematicsscore()>=64&&a[l].getMathematicsscore()<=65.9)
      l1=1.5;
     else if(a[l].getMathematicsscore()>=60&&a[l].getMathematicsscore()<=63.9)
      l1=1.0;
     else
      l1=0;
    
     if(a[l].getEnglishiscore()>=90) {
    } else if(a[l].getEnglishiscore()>=85&&a[l].getEnglishiscore()<=89.9)
      l2=3.7;
     else if(a[l].getEnglishiscore()>=82&&a[l].getEnglishiscore()<=84.9)
      l2=3.3;
     else if(a[l].getEnglishiscore()>=78&&a[l].getEnglishiscore()<=81.9)
      l2=3.0;
     else if(a[l].getEnglishiscore()>=75&&a[l].getEnglishiscore()<=77.9)
      l2=2.7;
     else if(a[l].getEnglishiscore()>=72&&a[l].getEnglishiscore()<=74.9)
      l2=2.3;
     else if(a[l].getEnglishiscore()>=68&&a[l].getEnglishiscore()<=71.9)
      l2=2.0;
     else if(a[l].getEnglishiscore()>=66&&a[l].getEnglishiscore()<=67.9)
      l2=1.7;
     else if(a[l].getEnglishiscore()>=64&&a[l].getEnglishiscore()<=65.9)
      l2=1.5;
     else if(a[l].getEnglishiscore()>=60&&a[l].getEnglishiscore()<=63.9)
      l2=1.0;
     else
      l2=0;
    
     if(a[l].getNetworkscore()>=90)
      l3=4.0;
     else if(a[l].getNetworkscore()>=85&&a[l].getNetworkscore()<=89.9)
      l3=3.7;
     else if(a[l].getNetworkscore()>=82&&a[l].getNetworkscore()<=84.9)
      l3=3.3;
     else if(a[l].getNetworkscore()>=78&&a[l].getNetworkscore()<=81.9)
      l3=3.0;
     else if(a[l].getNetworkscore()>=75&&a[l].getNetworkscore()<=77.9)
      l3=2.7;
     else if(a[l].getNetworkscore()>=72&&a[l].getNetworkscore()<=74.9)
      l3=2.3;
     else if(a[l].getNetworkscore()>=68&&a[l].getNetworkscore()<=71.9)
      l3=2.0;
     else if(a[l].getNetworkscore()>=66&&a[l].getNetworkscore()<=67.9)
      l3=1.7;
     else if(a[l].getNetworkscore()>=64&&a[l].getNetworkscore()<=65.9)
      l3=1.5;
     else if(a[l].getNetworkscore()>=60&&a[l].getNetworkscore()<=63.9)
      l3=1.0;
     else
      l3=0;
    
     if(a[l].getDatabasescore()>=90)
      l4=4.0;
     else if(a[l].getDatabasescore()>=85&&a[l].getDatabasescore()<=89.9)
      l4=3.7;
     else if(a[l].getDatabasescore()>=82&&a[l].getDatabasescore()<=84.9)
      l4=3.3;
     else if(a[l].getDatabasescore()>=78&&a[l].getDatabasescore()<=81.9)
      l4=3.0;
     else if(a[l].getDatabasescore()>=75&&a[l].getDatabasescore()<=77.9)
      l4=2.7;
     else if(a[l].getDatabasescore()>=72&&a[l].getDatabasescore()<=74.9)
      l4=2.3;
     else if(a[l].getDatabasescore()>=68&&a[l].getDatabasescore()<=71.9)
      l4=2.0;
     else if(a[l].getDatabasescore()>=66&&a[l].getDatabasescore()<=67.9)
      l4=1.7;
     else if(a[l].getDatabasescore()>=64&&a[l].getDatabasescore()<=65.9)
      l4=1.5;
     else if(a[l].getDatabasescore()>=60&&a[l].getDatabasescore()<=63.9)
      l4=1.0;
     else
      l4=0;
    
     if(a[l].getNetworkscore()>=90)
      l5=4.0;
     else if(a[l].getNetworkscore()>=85&&a[l].getNetworkscore()<=89.9)
      l5=3.7;
     else if(a[l].getNetworkscore()>=82&&a[l].getNetworkscore()<=84.9)
      l5=3.3;
     else if(a[l].getNetworkscore()>=78&&a[l].getNetworkscore()<=81.9)
      l5=3.0;
     else if(a[l].getNetworkscore()>=75&&a[l].getNetworkscore()<=77.9)
      l5=2.7;
     else if(a[l].getNetworkscore()>=72&&a[l].getNetworkscore()<=74.9)
      l5=2.3;
     else if(a[l].getNetworkscore()>=68&a[l].getNetworkscore()<=71.9)
      l5=2.0;
     else if(a[l].getNetworkscore()>=66&&a[l].getNetworkscore()<=67.9)
      l5=1.7;
     else if(a[l].getNetworkscore()>=64&&a[l].getNetworkscore()<=65.9)
      l5=1.5;
     else if(a[l].getNetworkscore()>=60&&a[l].getNetworkscore()<=63.9)
      l5=1.0;
     else
      l5=0;
     double tt,ttt;
     tt=(l1*4+l2*3+l3*4+l4*3+l5*2)/16;
        ttt=(double)Math.round(tt*100)/100;
     System.out.println("***********************************************");
     System.out.println("            石家庄铁道大学软件工程系学生学籍管理系统2019版");
      System.out.println("                          学生考试成绩录入");
      System.out.println("***********************************************");
      System.out.println("                          学生学号:"+a[l].getStunumber());
      System.out.println("                          学生姓名:"+a[l].getName());
      System.out.println("                          高等数学绩点:"+l1);
      System.out.println("                          大学英语绩点:"+l2);
      System.out.println("                          计算机网络绩点:"+l3);
      System.out.println("                          数据库绩点:"+l4);
      System.out.println("                          软件工程绩点:"+l5);
      System.out.println("                          你的平均绩点绩点:"+ttt);
      if(tt>=2)
      System.out.println("                          你的学分绩点达到毕业水平");
      else
       System.out.println("                      你的学分绩点没有达到毕业水平");
      System.out.println("                          该学生成绩录入完毕,是否提交(Y/N)");
      System.out.println("***********************************************");
      String n6;
      n6=sc.next();
      if(n6.equals("Y")) {
       zhuye();
      }
      if(n6.equals("y")) {
       zhuye();
      }
      if(n6.equals("N")) {
       jidian();
       jisuan();
      }
      if(n6.equals("n")) {
       jidian();
       jisuan();
      }
   }
   
 }  
}

课堂测试

标签:测试   输入数据   net   setname   int   生成   for   ack   界面   

原文地址:https://www.cnblogs.com/--lzx1--/p/11515649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!