UML - CLASSES DIAGRAM - A specific problem

:?: Hello,

Thank you for reading me.
The diagram I have to draw is a classes diagram.

The situation is the following:
suppose there are only two ways in which one can pay for something somewhere:

  • with a credit card (attributes: number and date),
  • with a cheque (attribute: number).

Suppose there is one type of payment per bill.
Suppose there is a BILL class.

I was thinking about creating three classes:

  • PAYMENT (no attributes),
  • PAYMENT_BY_CREDIT_CARD (attributes: number, date),
  • PAYMENT_BY_CHEQUE (attributes: number)
    with PAYMENT_BY_CREDIT_CARD and PAYMENT_BY_CHEQUE
    being sub-classes of PAYMENT.

I am a beginner, I sincerely don’t know how to represent this situation, please help me.

Thanks a lot in advance.

Common attributes should be assgned to the payment class - ‘account number’, ‘amount’, etc.

Les

Thanks Leslie for your answer.

A solution that was exposed to me makes of:
-> PAYMENT an abstract class,
-> and PAYMENT_BY_CREDIT_CARD and PAYMENT_BY_CHEQUE
two subclasses of the PAYMENT class.

For PAYMENT, in ArgoUML, a class was created with no attributes and a stereotype <>.

For PAYMENT_BY_CREDIT_CARD was created a class with two attributes: number and date.

For PAYMENT_BY_CHEQUE was created a class with one attribute: number.

You should consider using superclass of Payment with attributes od Date, Amount etc, and 2 subclasses of CredtCardPayment and ChequingAccountPayment with their own specific attributes that are not in the superclass.

Thanks for your help!