zoukankan      html  css  js  c++  java
  • 第十二次作业

    package 第十二次;
    
    public abstract class Person {
        private String name;
        private int age;
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getAge() {
            return age;
        }
        public void setAge(int age) {
            this.age = age;
        }
        public Person(String name, int age) {
            this.name = name;
            this.age = age;
        }
        public Person() {
            super();
        }
        @Override
        public String toString() {
            return "Person [name=" + name + ", age=" + age + "]";
        }
        public abstract String speak();
    }
    package 第十二次;
    
    public class Student extends Person{
        private float score;
        
        public Student(String name, int age, float score) {
            super(name, age);
            this.setScore(score);
        }
        @Override
        public String speak() {
            return "学生说-->我的姓名:"+super.getName()+" "+super.getAge()+"岁 "+this.score+"分";
        }
        public float getScore() {
            return score;
        }
        public void setScore(float score) {
            this.score = score;
        }
    }
    package 第十二次;
    
    public class Worker extends Person {
        private float salary;
        
        public Worker(String name, int age, float salary) {
            super(name, age);
            this.setSalary(salary);
        }
        @Override 
        public String speak() {
            return "工人说 -->我的姓名:"+super.getName()+" "+super.getAge()+"岁 "+this.salary+"元";
        }
        public float getSalary() {
            return salary;
        }
        public void setSalary(float salary) {
            this.salary = salary;
        }
    }
    package 第十二次;
    
    public class DemoStudentWorker {
    
        public static void main(String[] args) {
            Person student=new Student("旺财",3, 90.5f);
            Person worker=new Worker("小强",1, 8125.5f);
            print(student.speak());
            print(worker.speak());
        }
        private static void print(String speak) {
            System.out.println(speak);
        }
    }

    public class Shulie {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            int arr[] = new int[7];
            arr[0] = 1;        
            arr[1] = 1;        
            for (int i = 2; i < arr.length; i++) 
            {            
                arr[i] = arr[i - 1] + arr[i - 2];
                System.out.println(arr[i]);
            }
        }
    
    }

    public class Maopao {
    
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            int[] arr={23,234,3,1,19,21,231,88,90,11};
        
            for(int i=0;i<arr.length-1;i++) {
                for(int j=0;j<arr.length-1;j++) {
                    if(arr[j]>arr[j+1]) {
                        int temp=arr[j];
                        arr[j]=arr[j+1];
                        arr[j+1]=temp;
                    }
                }
            }
            System.out.println("排序后:");
            for(int num:arr) {
                System.out.println(num+" ");
            }
        }
    
    }

  • 相关阅读:
    [实变函数]4.4 依测度收敛
    [实变函数]4.3 可测函数的构造
    [实变函数]4.2 Egrov 定理
    [实变函数]4.1 可测函数 (measurable function) 及其性质
    [实变函数]4.0 引言
    [实变函数]3.3 可测集类
    垂直滚动选择效果的实现
    unity模型任意无限切割插件
    微信小程序—智能小蜜(基于智能语义解析olami开放平台)
    AdPlayBanner:功能丰富、一键式使用的图片轮播插件
  • 原文地址:https://www.cnblogs.com/xyayy/p/7979158.html
Copyright © 2011-2022 走看看