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());
                
            }
            
            
        }

    }

  • 相关阅读:
    Vue3源码系列之触发更新的实现
    Vue3源码系列之依赖收集的实现
    Vue3源码系列之reactiveApi实现
    删除链表的倒数第n个节点
    Shared_ptr 参考实现
    linux 目录结构 比较老
    C++11 bind function
    状态机DP
    尾递归
    秒杀系统的构建(2)
  • 原文地址:https://www.cnblogs.com/xuannidaolao/p/9104267.html
Copyright © 2011-2022 走看看