• Java--教师类


    
    
    package com.company;
    class teacher
    {
        int number;
        String name ;
        String borndate ;
        String sex;
        String workplace ;
        String position ;
    
        void show()
        {
            System.out.print(+number+" ");
            System.out.print( name+" " );
            System.out.print( sex+" " );
            System.out.print( borndate+" " );
            System.out.print( position+" ");
            System.out.println( workplace+" " );
            System.out.print("研究 ");
            System.out.print("实验 ");
            System.out.print("行政 ");
            System.out.println("图书管理");
        }
    }
    class student extends teacher
    {
        String grade;
        void show()
        {
            System.out.print(+number+" ");
            System.out.print( name+" " );
            System.out.print( sex+" " );
            System.out.print( borndate+" " );
            System.out.print( position+" ");
            System.out.print( grade+" " );
            System.out.println( workplace+" " );
            System.out.print("吃饭 ");
            System.out.print("学习 ");
            System.out.print("睡觉 ");
            System.out.println("看书");
    
        }
    }
    public class Main {
    
        public static void main(String[] args) {
            // write your code here
            teacher t = new teacher();
            student s = new student();
            t.borndate = ("2000/9/9");
            t.name = ("张三");
            t.number = 1195;
            t.position= "老师";
            t.sex="男";
            t.workplace="教师办公室";
            s.borndate = ("2018/9/9");
            s.name = ("李四");
            s.number = 1000;
            s.position= "学生";
            s.sex="男";
            s.workplace="教室";
            s.grade="三年级";
            t.show();
            s.show();
    
    
        }
    }
    
    
    
     
  • 相关阅读:
    鸡兔同笼问题
    猴子吃桃问题
    Fibonacci_sequence(斐波那契数列)
    Joseph_Circle(约瑟夫环)
    学生成绩管理--功能全--较难
    各种排序
    二叉排序树操作--基本
    面向对象程序设计(多继承)--简单
    面向对象程序设计3--简单
    使用 ASR 和 Azure Pack 为 IaaS 工作负荷提供托受管 DR
  • 原文地址:https://www.cnblogs.com/zhouxiaoyue/p/14170989.html
Copyright © 2020-2023  润新知