工厂模式——quicken

import javax.swing.JOptionPane;


public class Quicken {
    public static void main(String[] args) {
       Financial b[]={new ICBC(),new ABC(),new Futures(),new Stock()};
        int now=0;
        //b[1].withdraw(100);
        //b1.deposit(50);
        for(Financial m:b )
       m.current(now);
     JOptionPane.showMessageDialog(null,"hello world","sample",JOptionPane.WARNING_MESSAGE);
     System.out.print("Your current money {1}quot;+now);
    }
}

interface Financial{
    float current(float now);
}
interface BankAccount extends Financial{
   static int a=0;
   public void  withdraw(float money);
   public  void  deposit(float money);
  //  float   current(float now);
}

class ICBC implements BankAccount {
    float a=0; 
     public void  withdraw(float money){
         a-=money;
        System.out.println("Withdraw {1}quot;+money+" from "+this.getClass().getSimpleName());
     }
    public void  deposit(float money){
        a+=money;
        System.out.println("Deposit {1}quot;+money+" from "+this.getClass().getSimpleName()); 
    }
    public float current(float now)
    {   if(a>0)
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
    else
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
       now+=a;
       return  now;
    }
}

class ABC implements BankAccount{
    float a=0; 
     public void  withdraw(float money){
         a-=money;
        System.out.println("Withdraw {1}quot;+money+" from "+this.getClass().getSimpleName());
     }
    public void  deposit(float money){
        a+=money;
        System.out.println("Deposit {1}quot;+money+" from "+this.getClass().getSimpleName()); 
    }
    public float current(float now)
    {   if(a>0)
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
    else
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
       now+=a;
       return  now;
    }
}

interface Investment  extends Financial{
   static int a=0;
    void  lose(float money);
    void  earn(float money);
    float   current(float now);
}

class Futures implements Investment{
    float a=0; 
     public void  lose(float money){
         a-=money;
        System.out.println("Loss {1}quot;+money+" from "+this.getClass().getSimpleName());
     }
    public void  earn(float money){
        a+=money;
        System.out.println("Earn {1}quot;+money+" from "+this.getClass().getSimpleName()); 
    }
    public float current(float now)
    {   if(a>0)
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
    else
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
       now+=a;
       return  now;
    }
}

class Stock implements Investment{
    float a=0; 
     public void  lose(float money){
         a-=money;
        System.out.println("Loss {1}quot;+money+" from "+this.getClass().getSimpleName());
     }
    public void  earn(float money){
        a+=money;
        System.out.println("Earn {1}quot;+money+" from "+this.getClass().getSimpleName()); 
    }
    public float current(float now)
    {   if(a>0)
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
    else
    System.out.println(this.getClass().getSimpleName() +" current money {1}quot;+a);
       now+=a;
       return  now;
    }
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
speed和speed-profile是Android N编译模式中的两种选项。speed是一种编译模式,旨在最大化运行时性能,而speed-profile则是一种部分编译模式,根据profile记录的热点函数来编译,也是为了最大化运行时性能。在Android N中,通过设置LOCAL_DEX_PREOPT_FLAGS参数来选择编译模式。如果没有指定编译过滤器,则默认使用speed模式,如果有配置LOCAL_DEX_PREOPT_GENERATE_PROFILE参数为true,则使用speed-profile模式,否则使用quicken模式。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ART编译模式学习](https://blog.csdn.net/m0_53696288/article/details/127584582)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [Android热修复技术 --- 兼容性问题深入](https://blog.csdn.net/qq_33235287/article/details/124079469)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [adb安装模式修改为speed模式、](https://blog.csdn.net/fan380485838/article/details/81908591)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值