zoukankan      html  css  js  c++  java
  • 智能手机与普通手机功能实现

    package com.day06;
    /*
     * 父类手机
     */
    public class Shouji {
        private String brand;
        private String type;
        
        public String getBrand() {
            return brand;
        }
        public void setBrand(String brand) {
            this.brand = brand;
        }
        public String getType() {
            return type;
        }
        public void setType(String type) {
            this.type = type;
        }
        public void call() {
            System.out.println("通话功能");
        }
        public void faXinxi() {
            System.out.println("发信息");
        }
        public void shouXinxi() {
            System.out.println("收信息");
        }
    
    }
    package com.day06;
    /*
     * 照相接口
     */
    public interface Zhaoxiang {
        public void zhaoXiang();
    
    }
    package com.day06;
    /*
     * 上网接口
     */
    public interface Lianwifi {
        public void lianwifi();
    
    }
    package com.day06;
    /*
     * 智能手机--子类
     */
    public class Zhineng extends Shouji implements Zhaoxiang,Lianwifi,Bofang{
    
        @Override
        public void lianwifi() {
            // TODO Auto-generated method stub
            System.out.println("连接wifi");
        }
    
        @Override
        public void zhaoXiang() {
            // TODO Auto-generated method stub
            System.out.println("照相");
        }
    
        @Override
        public void bofang() {
            // TODO Auto-generated method stub
            System.out.println("播放视频");
        }
    
    }
    package com.day06;
    /*
     * 播放接口
     */
    public interface Bofang {
        public void bofang();
    
    }
    package com.day06;
    /*
     * 普通手机--子类
     */
    public class Putong extends Shouji implements Bofang{
    
        @Override
        public void bofang() {
            // TODO Auto-generated method stub
            System.out.println("播放视频");
        }
    
    }
    package com.day06;
    /*
     * 测试类
     */
    
    public class Test {
        public static void main(String[] args) {
            Zhineng  z = new Zhineng();
            System.out.println("智能手机功能:");
            z.call();
            z.faXinxi();
            z.shouXinxi();
            z.lianwifi();
            z.zhaoXiang();
            z.bofang();
            
            System.out.println("--------------------------------");
            
            
            
            System.out.println("普通手机功能");
            Putong p = new Putong();
            p.bofang();
            p.call();
            p.faXinxi();
            p.shouXinxi();
        }
        
    
    }

  • 相关阅读:
    4. Median of Two Sorted Arrays
    3. Longest Substring Without Repeating Characters
    695. Max Area of Island
    2015 Benelux Algorithm Programming Contest E-Excellent Engineers
    URAL
    Codeforces Round #309 (Div. 2) -D. Kyoya and Permutation
    Codeforces Round #144 (Div. 2) D table
    Codeforces Round #429 (Div. 2)
    Codeforces 610D Vika and Segments
    Codeforces 757D
  • 原文地址:https://www.cnblogs.com/hxtzzz/p/11212296.html
Copyright © 2011-2022 走看看