• 140201129贾杰峰作业三


    class Student {
     private String stuno;
     private String name;
     private float math;
     private float english;
     private float computer;
     public Student(){
      
     }
     public Student(String stuno,String name,float math,float english,float computer){
      this.setStuno(stuno);
      this.setName(name);
      this.setMath(math);
      this.setEnglish(english);
      this.setComputer(computer);
     }
     public void setStuno(String s){
      stuno=s;
     }
     public void setName(String n){
      name=n;
     }
     public void setMath(float m){
      math=m;
     }
     public void setEnglish(float e){
      english=e;
     }
     public void setComputer(float c){
      computer=c;
     }
     public String getStuno(){
      return stuno;
     }
     public String getName(){
      return name;
     }
     public float getMath(){
      return math;
     }
     public float getEnglish(){
      return english;
     }
     public float getComputer(){
      return computer;
     }
     public float sum(){
      return math+english+computer;
     }
     public float avg(){
      return this.sum()/3;
     }
     public float max(){
      float max=math;
      max=max>computer?max:computer;
      max=max>english?max:english;
      return max;
     }
     public float min(){
      float min=math;
      min=min<computer?min:computer;
      min=min<english?min:english;
      return min;
     }
    }
    public class ExampleDemo01 {

     /**
      * @param args
      */
     public static void main(String args[]) {
      Student stu=null;
      stu=new Student("MLDN-33","李兴华",95.0f,89.0f,96.0f);
      System.out.println("学生编号:"+stu.getStuno());
      System.out.println("学生姓名:"+stu.getName());
      System.out.println("数学成绩:"+stu.getMath());
      System.out.println("英语成绩:"+stu.getEnglish());
      System.out.println("计算机成绩:"+stu.getComputer());
      System.out.println("最高分:"+stu.max());
      System.out.println("最低分:"+stu.min());// TODO Auto-generated method stub

     }

    }

    class Address3 {
     private String guojia;
     private String shengfen;
     private String chengshi;
     private String jiedao;
     private int youbian;
     public Address3(){
      
     }
     public Address3(String guojia,String shengfen,String chengshi,String jiedao,int youbian){
      this.setGuojia(guojia);
      this.setShengfen(shengfen);
      this.setChengshi(chengshi);
      this.setJiedao(jiedao);
      this.setYoubian(youbian);
     }
     public void setGuojia(String g){
      guojia=g;
     }
     public void setShengfen(String s){
      shengfen=s;
     }
     public void setChengshi(String c){
      chengshi=c;
     }
     public void setJiedao(String j){
      jiedao=j;
     }
     public void setYoubian(int y){
      youbian=y;
     }
     public String getGuojia(){
      return guojia;
     }
     public String getShengfen(){
      return shengfen;
     }
     public String getChengshi(){
      return chengshi;
     }
     public String getJiedao(){
      return jiedao;
     }
     public int getYoubian(){
      return youbian;
     }
     
    }
    public class Address1 {
     public static void main(String args[]) {
      Address3 add=null;
      add=new Address3("中国","北京","北京","牛栏山",101301);
      System.out.println("国家:"+add.getGuojia());
      System.out.println("省份:"+add.getShengfen());
      System.out.println("城市:"+add.getChengshi());
      System.out.println("街道:"+add.getJiedao());
      System.out.println("邮编:"+add.getYoubian());
      // TODO Auto-generated method stub

     }

    }

    class Employee1 {
     private String empno;
     private String name;
     private float gongzi;
     private float zengzhange;
     private float zonge;
     public Employee1(){
     }
     public Employee1(String empno,String name,float gongzi){
      this.setEmpno(empno);
      this.setName(name);
      this.setGongzi(gongzi);
      this.setZengzhange(zengzhange);
      this.setZonge(zonge);
     }
     public void setEmpno(String e){
      empno=e;
     }
     public void setName(String n){
      name=n;
     }
     public void setGongzi(float g){
      gongzi=g;
     }
     public void setZengzhange(float z){
      z=gongzi*0.05f;
      zengzhange=z;
     }
     public void setZonge(float Z){
      Z=gongzi+zengzhange;
      zonge=Z;
     }
     public String getEmpno(){
      return empno;
     }
     public String getName(){
      return name;
     }
     public float getGongzi(){
      return gongzi;
     }
     public float getZengzhange(){
      return zengzhange;
     }
     public float getZonge(){
      return zonge;
     }
    }
    public class Employee {

     /**
      * @param args
      */
     public static void main(String args[]) {
      Employee1 emp=null;
      emp=new Employee1("1","李兴华",3000.5f);
      System.out.println("员工编号:"+emp.getEmpno());
      System.out.println("员工姓名:"+emp.getName());
      System.out.println("员工工资:"+emp.getGongzi());
      System.out.println("薪水增长额:"+emp.getZengzhange());
      System.out.println("总额:"+emp.getZonge());
      // TODO Auto-generated method stub

     }

    }

    class Dog1 {
     private String name;
     private String color;
     private String hobby;
     private int age;
     public Dog1(){
     }
     public Dog1(String name,String color,String hobby,int age){
      this.setName(name);
      this.setColor(color);
      this.setHobby(hobby);
      this.setAge(age);
     }
     public void setName(String n){
      name=n;
     }
     public void setColor(String c){
      color=c;
     }
     public void setHobby(String h){
      
      hobby=h;
     }
     public void setAge(int a){
      age=a;
     }
     public String getName(){
      return name;
     }
     public String getColor(){
      return color;
     }
     public String getHobby(){
      return hobby;
     }
     public int getAge(){
      return age;
     }
    }
    public class Dog {

     /**
      * @param args
      */
     public static void main(String args[]) {
      Dog1 dog=null;
      dog=new Dog1("小黑","黑色","乱叫",3);
      System.out.println("名字:"+dog.getName());
      System.out.println("颜色:"+dog.getColor());
      System.out.println("喜好:"+dog.getHobby());
      System.out.println("年龄:"+dog.getAge());
      // TODO Auto-generated method stub

     }

    }

    class User1 {
     private String name;
     private int key;
     private int count;
     public User1(){
     }
     public User1(String name,int key,int count){
      this.setName(name);
      this.setKey(key);
      this.setCount(count);
     }
     public void setName(String n){
      name=n;
     }
     public void setKey(int k){
      key=k;
     }
     public void setCount(int c){
      count=c;
     }
     public String getName(){
      return name;
     }
     public int getKey(){
      return key;
     }
     public int getCount(){
      return count;
     }
    }
    public class User {

     /**
      * @param args
      */
     public static void main(String args[]) {
      User1 user=null;
      user=new User1("张",0,1);
      System.out.println("用户名:"+user.getName());
      System.out.println("口令:"+user.getKey());
      System.out.println("用户个数:"+user.getCount());
      // TODO Auto-generated method stub

     }

    }

  • 相关阅读:
    vue-cli 3.0 路由懒加载
    vue 路由拦截、axios请求拦截
    vue-cli 3.0 图片路径问题(何时使用 public 文件夹)
    vue 监听页面宽度变化 和 键盘事件
    WGS84、GCJ-02(火星坐标)、百度坐标,Web墨卡托坐标
    Java学习之道:Java项目打包发布
    ora-14550问题解决
    费氏搜寻法之算法分析与实现
    [置顶] woff格式字体怎么打开和编辑?
    C++小知识之Vector排序
  • 原文地址:https://www.cnblogs.com/jiajiefeng/p/5304200.html
Copyright © 2020-2023  润新知