• 学生成绩管理


    public class Grade {
        private
                   double english;
         double math;
        double Chinese;
         
        public:
                  Grade(double english, double math, double Chinese)
         {
            this.english = english;
            this.math = math;
            this.Chinese = Chinese;
        }
     
         double sum() 
        {
            return this.english+this.math+this.Chinese;
        }
         
         void displayTotal() 
        {
            System.out.println(sum());
        }
         
         double average() 
        {
            return total()/3;
        }
         
         void displayAverage() 
        {
            System.out.println(average());
        }
         double getEnglish() 
        {
            return english;
        }
     
         void setEnglish(double english)
         {
            this.english = english;
        }
     
        double getMath()
         {
            return math;
        }
     
        void setMath(double math)
         {
            this.math = math;
        }
     
        public double getChinese() 
         {
            return Chinese;
        }
     
        public void setChinese(double Chinese) {
            this.Chinese = Chinese;
        }
    }
    public class Student {
        String name;
        Grade grade;
        public Student(String name, Grade grade) {
            this.name = name;
            this.grade = grade;
        }
         
    public static void main(String[] args) 
    {
            Student s = new Student("Cici"new Grade(708090));
            s.grade.printAverage();
            s.grade.printTotal();
        }
    }
  • 相关阅读:
    开发人员维护测试数据库
    mybatis 自动生成 dao层 entity和xml时遇到的问题
    产品上线过程中犯下的错误
    leetcode: invert binary tree
    重构函数基本原则(持续更新)
    通过Mybatis获取mysql表中重复记录的方法
    Vmware 部分所学到的功能简写
    Vmware 主机锁定模式
    光纤卡网卡的区别以及HBA的常规定义-----引自百度百科
    存储基本概念(lun,volume,HBA,DAS,NAS,SAN,iSCSI,IPSAN)
  • 原文地址:https://www.cnblogs.com/xxym/p/9101945.html
Copyright © 2020-2023  润新知