本文介绍了代表这种图的常见方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我需要代表客户的付款,在机场购买机票。 机场系统有奖励制度。 因此,客户可以通过奖金或其他付款系统或一起付款。 我想创建一个名为 PaymentMethod 的接口,使这个层次结构: ByPaymentSystem (Interface), ByBonuse (Class), ByMix (依赖于 ByPaymentSystem 的类) webmoney , mastercard 等。 另外,我想创建一个 PaymentService 类,它将使用方法 pay $ c> method:PaymentMethod ,并且获取有关付款类型的具体信息。 我不确定 $ b $ b 请不要打破我的声誉,只是评论你的意见。我将审查他们,而不是决定这个主题的命运。如果这是必要的,我准备想象所有我对UML类图中的subj的想法。 这是我的图的一部分的草稿 我想做这样的东西, t知道如何进一步处理。 如何通过红利和信用现金表示支付情况: UPD:此项目是一个avia公司的网站。公司有bonuse英里系统。这意味着经常飞行的客户可以获得一些免费的千米奖金,因为他们可以支付飞行的一部分。 当然,他们可以通过信用卡付款,甚至结合这种方法。 - 我有股票。如何表示组合? 我需要代表满足上述需求的类图。 UPD: 解决方案您应该从问题域的模型开始。我会期望像下面这样: 此图说明: A 客户 更多付款支付给付款服务 A 付款服务 接受一个或多个付款 >客户 每个付款都有金额 A 付款必须是里程付款,现金付款或信用卡付款 付款 s 为了解答您的问题,让您的 pay()方法接受一组付款。对于每种 Payment ,不需要下级接口,只需要各种类实现。我会使用多态操作来借记(如果这是正确的单词),如果有任何失败,回滚,并在所有的借记成功时提交。 I need to represent the payment of a customer to buy a flight ticket in an airport.The system of airport has a bonus system.So customer can make payment for ticket by a bonus or by another payment system or together. But I don't know how to represent it all together.I wanna make the interface that called PaymentMethod and make this hierarchy : ByPaymentSystem(Interface), ByBonuse(Class), ByMix(Class that dependet from ByPaymentSystem)Payment system will also have many realizations f.e. :webmoney, mastercard and so on.And also I wanna make a PaymentService class that will have method pay that will take a parameter method:PaymentMethod and also take an specific information about the kind of payment.I am not sure about ByMix class, and my spirit wanna avoid this class.What do u think about it ?Please don't break down my reputation but just comment your opinion. I will review them and than make decision about destiny of this topic. Also I prepeare imagine all my thoughts about subj in UML class diagram if that will be necessary.This is the my draft of a part of my diagramI wanna make something like that but i don't know how to deal further.How to represent payment by mixed case: by bonuses and by credit cash.UPD:This project is the site of an avia-company. The company have bonuse miles system. That means the frequently flying customers can receive some free kilometeres bonuses by that they can pay some part of a flight.Of course they can make payment by credit card or even combine that methods. - there I have stock. How to represent that combination ?I need to represent the class diagram that will satisfy the desires above.UPD: 解决方案 You should start with a model of the problem domain. I would expect something like the following:This diagram states that:A Customer offers one or more Payments to a Payment ServiceA Payment Service accepts one or more Payments offered by a CustomerEach Payment has an amountA Payment must be a Mileage Payment, Cash Payment, or Credit Card PaymentThere is no overlap among the types of PaymentsTo then answer your question in terms of the solution domain, I would have your pay() method accept a collection of payments. You don't need subordinate interfaces for each kind of Payment, only various class implementations. I would use polymorphic operations to debit (if that's the right word), roll back if anything fails, and commit when all the debits succeed. 这篇关于代表这种图的常见方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-28 22:59