接口实现手机功能

1. 实现思路
2. 编写类及接口
3. 编写测试类、让手机播放音频、发信息和通电话
4. 让智能手机上网、播放视频、照相、发信息和通电话

TheakePictures接口
//照相
 public interface TheakePictures {
   		 void takePictures();
		}``
NetWork接口
//连接网络
public interface NetWork {
    void netWorkConn();
}
PlayWiring 接口
//播放
public interface PlayWiring {
    void play();
/**
 * 手机抽象类
 */
public abstract  class Handset {
    private  String brand;
    private  String type;

    public abstract void sendInfo();
    public abstract void call();
    public abstract void info();
    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 abstract void show();
}
/**
 * 智能手机类
 */
public class AptitudeHandset extends Handset implements NetWork,TheakePictures,PlayWiring{
    @Override
    public void sendInfo() {
        System.out.println(this.getBrand()+this.getType()+"发信息");
    }

    @Override
    public void call() {
        System.out.println(this.getBrand()+this.getType()+"打电话");
    }

    @Override
    public void info() {
        System.out.println(this.getBrand()+this.getType()+"收信息");
    }

    @Override
    public void netWorkConn() {
        System.out.println(this.getBrand()+this.getType()+"上网");
    }

    @Override
    public void play() {
        System.out.println(this.getBrand()+this.getType()+"播放视频");
    }

    @Override
    public void takePictures() {
        System.out.println(this.getBrand()+this.getType()+"照照片");
    }
    public void show(){
        this.netWorkConn();
        this.call();
        this.sendInfo();
        this.takePictures();
        this.play();
    }
}
/**
 * 普通手机类
 */
public class CommonHandset extends Handset implements PlayWiring {
    @Override
    public void sendInfo() {
        System.out.println(this.getBrand()+this.getType()+"手机发信息");
    }

    @Override
    public void call() {
        System.out.println(this.getBrand()+this.getType()+"手机打电话");
    }

    @Override
    public void info() {
        System.out.println(this.getBrand()+this.getType()+"手机收信息");
    }

    @Override
    public void play() {
        System.out.println(this.getBrand()+this.getType()+"手机播放视频");
    }

    @Override
    public void show() {
        this.call();
        this.sendInfo();
        this.play();
    }
}
import java.util.Scanner;

/**
 * 装配手机类
 */
public class Host {
    Scanner sc=new Scanner(System.in);

    int brandId,typeId;//手机品牌 手机型号

    public Handset select(int type){
        Handset handset;
        if(type==1){
            /**
             * 实现智能手机功能
             */

            handset=new AptitudeHandset();
            System.out.println("1、小米 2、华为、 3、苹果");
            System.out.println("请选择手机品牌:");
            brandId=sc.nextInt();
            switch (brandId){
                case 1:
                    //设置手机品牌
                    handset.setBrand("小米");
                    // System.out.println(aptitudeHandset.getBrand());
                    System.out.println("1、红米 2、小米note 3、小米8");
                    System.out.println("请选择小米手机类型");
                    typeId=sc.nextInt();
                    //设置小米手机类型
                    if(typeId==1){
                        handset.setType("红米");
                        }else if (typeId==2){
                                handset.setType("小米note");
                            }else {
                                handset.setType("小米8");
                            }
                break;
                case 2:
                    handset.setBrand("华为");
                    System.out.println("1、荣耀  2、nava  3、华为10");
                    System.out.println("请选择华为手机类型");
                    typeId=sc.nextInt();
                    //设置小米手机类型
                    if(typeId==1){
                         handset.setType("荣耀 ");
                    }else if (typeId==2){
                         handset.setType("nava");
                    }else {
                         handset.setType("华为10");
                          }
                break;
                default:
                    handset.setBrand("苹果");
                    System.out.println("1、iphone7  2、iphoneX  3、iphone9");
                    System.out.println("请选择华为手机类型");
                    typeId=sc.nextInt();
                    //设置小米手机类型
                    if(typeId==1){
                        handset.setType("iphone7 ");
                    }else if (typeId==2){
                        handset.setType("iphoneX");
                    }else {
                        handset.setType("iphone9");
                    }
            break;
            }
        }else{
            /**
             * 实现普通手机功能
             */
            handset=new CommonHandset();
            System.out.println("1、诺基亚 2、金立手机 3、三星");
            System.out.println("请选择普通手机品牌");
            brandId=sc.nextInt();
            switch (brandId){
                case 1:
                    //设置手机品牌
                    handset.setBrand("诺基亚");
                    System.out.println("1、210黑色直板 2、105老人备用机 3、3.1plus移动版");
                    System.out.println("请选择诺基亚手机类型");
                    typeId=sc.nextInt();
                    if (typeId==1){
                        handset.setType("210黑色直板");
                    }else if(typeId==2){
                        handset.setType("105老人备用机");
                    }else {
                        handset.setType("3.1plus移动版");
                    }
                    break;
                case 2:
                    handset.setBrand("金立");
                    System.out.println("1、语音王 2、A350");
                    System.out.println("请选择金立手机类型");
                    typeId=sc.nextInt();
                    if(typeId==1){
                        handset.setType("语音王");
                    }else {
                        handset.setType("A350");
                    }
                    break;
                default:
                    handset.setBrand("三星");
                    System.out.println("1、B289电信 2、E1150老人机");
                    System.out.println("请选择三星手机类型");
                    typeId=sc.nextInt();
                    if(typeId==1){
                        handset.setType("B289电信");
                    }else {
                        handset.setType("E1150老人机");
                    }
                    break;
            }

        }
        return  handset;
    }
}
import java.util.Scanner;

/**
 * 测试类
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        Host host=new Host();
//        AptitudeHandset aptitudeHandset=new AptitudeHandset();
//        CommonHandset commonHandset=new CommonHandset();
        Handset handset;

        System.out.println("1、智能手机 2、普通手机");
        System.out.println("请选择手机类型:");
        int chiooce=sc.nextInt();

        handset=host.select(chiooce);
        handset.show();
    }
}
华为Nova3i手机原厂维修图纸 原理图 电路图 故障维修图(PDF版) 华为Nova3i 位置图 点位图 位号图.pdf 华为Nova3i 原理图 电路图.pdf 华为Nova3i 注释图 故障标注 主板元器件位置图.pdf 华为Nova3i 原厂图 维修流程图 AFC故障.pdf 华为Nova3i 原厂图 维修流程图 FDD LTE主集接收故障.pdf 华为Nova3i 原厂图 维修流程图 FDD LTE分集接收故障.pdf 华为Nova3i 原厂图 维修流程图 FDD LTE发射故障1.pdf 华为Nova3i 原厂图 维修流程图 FDD LTE发射故障2.pdf 华为Nova3i 原厂图 维修流程图 GPS故障.pdf 华为Nova3i 原厂图 维修流程图 GSM发射故障.pdf 华为Nova3i 原厂图 维修流程图 GSM接收故障.pdf 华为Nova3i 原厂图 维修流程图 LCD显示故障.pdf 华为Nova3i 原厂图 维修流程图 OTG故障.pdf 华为Nova3i 原厂图 维修流程图 PMU输出电压测量点与电压值.pdf 华为Nova3i 原厂图 维修流程图 SD卡故障.pdf 华为Nova3i 原厂图 维修流程图 SIM卡故障.pdf 华为Nova3i 原厂图 维修流程图 TD-SCDMA发射故障.pdf 华为Nova3i 原厂图 维修流程图 TD-SCDMA接收故障.pdf 华为Nova3i 原厂图 维修流程图 TDD LTE主集接收故障.pdf 华为Nova3i 原厂图 维修流程图 TDD LTE分集接收故障.pdf 华为Nova3i 原厂图 维修流程图 TDD LTE发射故障.pdf 华为Nova3i 原厂图 维修流程图 WCDMA&CDMA发射故障.pdf 华为Nova3i 原厂图 维修流程图 WCDMA&CDMA接收故障.pdf 华为Nova3i 原厂图 维修流程图 WIFI BT故障全.pdf 华为Nova3i 原厂图 维修流程图 不开机(大电流).pdf 华为Nova3i 原厂图 维修流程图 不开机(小电流).pdf 华为Nova3i 原厂图 维修流程图 不开机(无电流).pdf 华为Nova3i 原厂图 维修流程图 不识SD卡.pdf 华为Nova3i 原厂图 维修流程图 不识USB.pdf 华为Nova3i 原厂图 维修流程图 不识主卡.pdf 华为Nova3i 原厂图 维修流程图 不识副卡.pdf 华为Nova3i 原厂图 维修流程图 充电故障.pdf 华为Nova3i 原厂图 维修流程图 前摄像故障.pdf 华为Nova3i 原厂图 维修流程图 受话故障.pdf 华为Nova3i 原厂图 维修流程图 后摄像故障.pdf 华为Nova3i 原厂图 维修流程图 外观故障.pdf 华为Nova3i 原厂图 维修流程图 实物点测图.pdf 华为Nova3i 原厂图 维修流程图 射频发射框架图.pdf 华为Nova3i 原厂图 维修流程图 射频接收框架图.pdf 华为Nova3i 原厂图 维修流程图 开机定屏.pdf 华为Nova3i 原厂图 维修流程图 待机下电点测图.pdf 华为Nova3i 原厂图 维修流程图 扬声器故障.pdf 华为Nova3i 原厂图 维修流程图 指南针故障.pdf 华为Nova3i 原厂图 维修流程图 指纹故障.pdf 华为Nova3i 原厂图 维修流程图 接近光故障.pdf 华为Nova3i 原厂图 维修流程图 摄像头故障.pdf 华为Nova3i 原厂图 维修流程图 耳机故障.pdf 华为Nova3i 原厂图 维修流程图 触摸故障.pdf 华为Nova3i 原厂图 维修流程图 辅助功能故障.pdf 华为Nova3i 原厂图 维修流程图 送话故障.pdf 华为Nova3i 原厂图 维修流程图 重力感应故障.pdf 华为Nova3i 原厂图 维修流程图 闪光灯故障.pdf 华为Nova3i 原厂图 维修流程图 音频故障.pdf 华为Nova3i 原厂图 维修流程图 马达故障.pdf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值