原问题:
InstrumentType.java
public enum InstrumentType {
GUITAR, BANJO, DOBRO, FIDDLE, BASS, MANDOLIN;
public String toString() {
switch(this) {
case GUITAR: return "Guitar";
case BANJO: return "Banjo";
case DOBRO: return "Dobro";
case FIDDLE: return "Fiddle";
case BASS: return "Bass";
case MANDOLIN: return "Mandolin";
default: return "Unspecified";
}
}
}
新要求:
Rick’s Instrument application is
changing. The new requirements list as
follows:

解决方案 »

  1.   

    The entire problem, IMHO, has nothing to do with the enum class you typed here. Anything else you can provide?
      

  2.   

    Formbean.java
    private String sBuyFlg = "";
    private String sGuitar = "";
    private String sBanjo= "";
    private String sDobro= "";
    private String sFiddle= "";
    private String sBass= "";
    private String sMandolin= "";
    private String sCustomerName = "";
    private String sCustomerPhone ="";
    把这些做成set/get方法
    InstrumentType.java
    修改这个方法toString();
    将相应的值放到FormBean里
    同时设置sBuyFlg值,记录Custom是第几次来买
    并且把相应的Custom信息设置好
    再加一个方法,判断是否打折就可以了(sBuyFlg 和 Custom相关信息) 
      

  3.   

    期望LZ早上解决问题 Good Luck 过个好端午节^_^
      

  4.   


    期望LZ早日解决问题 Good happy 过个好端午节^_^
      

  5.   

    我对程序看的不是太懂 但为了方便之后的人解答 我写出新要求的大体翻译
    Rick’s Instrument application is
    changing. The new requirements list as
    follows:里克的仪器应用正在发生变化。新规定名单如下:   Rick wants to track the sales information,
    including which instruments have been sold
    to which customer. Also, Rick needs to store
    the contact information to customers.里克要跟踪销售信息,包括已售出的仪器哪些客户。
    此外,里克需要存储联系人信息的客户。
       To boost sales, Rick want to find the
    customers who have bought a certain
    number of instruments from his shop and tell
    them that they could buy later instruments at
    a discount. Now the number is set to 3 and
    the discount is 5% off the normal price.为了促进销售,里克想找到客户的折扣有多少
    谁从他的乐器店买了一些,并告诉他们,他们可以在购买后的文书。
    现在,这一数字被设置为3,价格折扣为5%,离正常的。  So you, the application developer,
    needs to help Rick to find which
    customers could buy instruments at
    discount. So Rick can contact with these
    customers and tell them that they could
    enjoy his favorable price terms for future
    purchase.所以,你的应用程序开发,需要帮助里克找到,
    顾客可以买到打折乐器。所以里克可以接触这些客户,
    并告诉他们,他们可以享受他对未来购买优惠的价格条款。Based on the original solution, design the
    application according to the new
    requirements. Show your whole design in
    a new class diagram.根据原来的方案,设计了应用程序根据新的要求。
    显示您的整个设计类图和一个新的类。   Then program the new application to
    satisfy this new requirement and test it.然后,新的应用程序来满足这一新要求并测试它。
      

  6.   

    先祝大家端午节快乐 如果有一个即时翻译的软件 不就轻松许多 推荐 Lingoes-灵格斯
      

  7.   

    楼主帖子内容我咋觉得是 header first 系列的风格呢?
      

  8.   

    《Header First OOA&D》 ?