zoukankan      html  css  js  c++  java
  • 学生成绩管理

    package 成绩统计;
    import java.util.Scanner;
    public class ScoreCensus {  
        
            private double  Math=0;
            private double  English=0;
            private double  Physical=0;
            public  void Input(int i)
            {
                  Scanner Sc=new Scanner(System.in);
                    System.out.print("输入第"+(i+1));
                    System.out.println("个学生的成绩信息:");
                    System.out.println("Math: ");
                    this.Math=Sc.nextDouble();
                    System.out.println("English: ");
                    this.English=Sc.nextDouble();
                    System.out.println("Physical: ");
                    this.Physical=Sc.nextDouble();
                
            }
            public double  Sum()
            {
                return (this.Math+this.English+this.Physical);
            }
            public double average()
            {
                double s;
                s=this.Sum()/3;
               return s;
            
            }
        public static void main(String[] args) {
            ScoreCensus s[]=new ScoreCensus[10];//使用对象数组要进行实例化,否则出现异常
            int i;
            for(i=0;i<s.length;i++)
            {
                s[i]=new ScoreCensus();//实例化
                s[i].Input(i);
                System.out.println(+s[i].Sum());
                System.out.println(+s[i].average());
                
            }
            
            
        }

    }

  • 相关阅读:
    按钮字体颜色的设置
    异常
    数据存储
    SQLiteOpenHelper
    MVC
    在单线程模型中 Message、Handler、Message Queue、Looper 之间的关系
    ListView 的优化方案
    fragment生命周期及优点
    ANR
    Android系统架构
  • 原文地址:https://www.cnblogs.com/xuannidaolao/p/9104267.html
Copyright © 2011-2022 走看看