zoukankan      html  css  js  c++  java
  • 140201126杨鹏飞作业六

    interface ClassName{
     public void getClassName();
    }
    class A implements ClassName{
     public void getClassName(){
      System.out.println("\t");
      System.out.println("新东方培训公司");
     }
    }
    public class Company {
     public static void main(String[] args) {
      A a=new A();
      a.getClassName();
     }

    }

     abstract class Employee3{
     private String name ;
     private String sex;
     private int age ;   
     public Employee3(String name,String sex,int age){
      this.name = name;
      this.age = age;
      this.sex = sex;
     }
     public String getName(){
      return this.name;
     }
     public String getSex(){
      return this.sex;
     }
     public int getAge(){
      return this.age;
     }
     public void say(){  
      System.out.println(this.getContent()); 
     }
     public abstract String getContent(); 
    };
    class Guanliceng extends Employee3{
     private String zhiwu1;
     private float nianxin;
     public Guanliceng(String name,String sex,int age,String zhiwu1,float nianxin){
      super(name,sex,age); 
      this.zhiwu1=zhiwu1;
      this.nianxin=nianxin;
     }
     public String getZhiwu1(){
      return this.zhiwu1;
     }
     public String getContent(){
      return "管理者信息 --> 姓名:" + super.getName()+
        ";性别:"+super.getSex()+";年龄:" + super.getAge()+
        ";职务:" + this.getZhiwu1()+";年薪:"+this.nianxin;
     }
    }
    class Zhigong extends Employee3{
     private String zhiwu2;
     private float yuexin;
     public Zhigong(String name,String sex,int age,String zhiwu2,float yuexin){
      super(name,sex,age); 
      this.zhiwu2=zhiwu2;
      this.yuexin=yuexin;
     }
     public String getZhiwu2(){
      return this.zhiwu2;
     }
     public String getContent(){
      return "职员信息 --> 姓名:" + super.getName()+
        ";性别:"+super.getSex()+";年龄:"+ super.getAge()+
        ";职务:" + this.getZhiwu2()+";月薪:"+this.yuexin;
     }
    }
    public class Employee2{
     public static void main(String args[]){
      Employee3 emp2 = null ; 
      Employee3 emp3 = null ;
      emp2 = new Guanliceng("张三","男",20,"主任",135003.5f); 
      emp3 = new Zhigong("李四","男",30,"技术部",3000.0f); 
      System.out.println("\t");
      emp2.say();
      System.out.println("\t");
      emp3.say(); 
     }
    }

    abstract class Shape1{
     public abstract void area();
     public abstract void perimeter();
    }
    class Juxing extends Shape1{
     private double length;
     private double width;
     private double S;
     private double C;
     public Juxing(double length,double width){
      this.length=length;
      this.width=width;
     }
     public void area(){
      S=length*width;
      System.out.println(S);
     }
     public void perimeter(){
      C=2*(length+width);
      System.out.println(C);
     }
    }
    class Yuanxing extends Shape1{
     private double banjin;
     private double S;
     private double C;
     public Yuanxing(double banjin){
      this.banjin=banjin; 
     }
     public void area(){
      S=3.14*banjin*banjin;
      System.out.println(S);
     }
     public void perimeter(){
      C=2*3.14*banjin;
      System.out.println(C);
     }
    }
    public class Shape{
     public static void main(String[] args) {
      Juxing j=new Juxing(12.3,6.7);
      System.out.println("\t");
      System.out.println("矩形面积  \t");
      j.area();
      System.out.println("矩形周长   \t");
      j.perimeter();
      System.out.println("圆形面积    \t");
      Yuanxing y=new Yuanxing(2.5);
      y.area();
      System.out.println("圆形周长    \t");
      y.perimeter();
     }
    }

  • 相关阅读:
    让你平步青云的10个谈话技巧
    瑞士心理学家和精神分析医师――荣格
    市场倍增理论
    淘宝网格,淘宝富人群
    波波的个人简历
    磁盘修复工具
    9种没结果的爱(未婚者必读)!!!
    网络投机市场
    网页数据抽取的方法介绍
    C#扩展方法试用
  • 原文地址:https://www.cnblogs.com/yangpengfei123/p/5401237.html
Copyright © 2011-2022 走看看