-1

Having a bit of trouble coming with a class diagram using the following information:

  • A services company provides its customers with services.
  • Customers can be of two types : Residential of Corporate
  • Residential customers can buy only residential services , Corporate customers allowed to buy corporate and residential services.
  • Residential services can be prepaid or postpaid , corporate services always postpaid
  • prepaid service can be renewed by the customer , postpaid service renewed automatically
  • 3G and ADSl Services sold to Residential and Corporate Customers , iFly Service sold to residential only.

Here is the UML Diagram that i made,would it work?enter image description here

enter image description here

Christophe
  • 68,716
  • 7
  • 72
  • 138
Abdalla Ismail
  • 409
  • 1
  • 4
  • 21
  • 1
    Possible duplicate of [Uml Diagram - object oriented](http://stackoverflow.com/questions/38553719/uml-diagram-object-oriented) – Peter Uhnak Jul 24 '16 at 17:19
  • The normal approach is to update your old question, not create a new one; they are literally the same. – Peter Uhnak Jul 24 '16 at 17:20
  • I deleted the older one.This one explains the problem – Abdalla Ismail Jul 24 '16 at 17:24
  • Please, in future, edit the original question rather than creating a new one with the same content. Increases the likelihood of getting down-votes and no answers at all. Also note that SO is no learning platform! – qwerty_so Jul 24 '16 at 18:38
  • I'm voting to close this question as off-topic because it just looks like "please do my homework for me" – qwerty_so Jul 24 '16 at 18:40
  • Possible duplicate of [Explanation of the UML arrows](http://stackoverflow.com/questions/1874049/explanation-of-the-uml-arrows) – Adam Martin Jul 24 '16 at 20:32
  • 1
    You seem to lack basic knowledge about UML. Almost nothing is correct in your diagram, starting with how to show a class, how to depict relationships, what do a specific relationship mean, how to present cardinalities etc. Please take any book (many available on-line) and read at leasts basics about UML usage. "UML for Dummies" might be a good start (no offence here, OMG suggests this resource on their webpage). If you want a bit more in-depth understanding it's worth to consider something about analysis, like Podesva's "UML for IT Business Analysts" or Lahrman's "Applying UML and Patterns", – Ister Jul 25 '16 at 06:10

1 Answers1

1

As you have to learn doing UML, I will let you draw you the schema. But here some hints to start your class diagram:

  • "A services company provides its customers with services" => this is just the general frame. We need a Customer and a Service class
  • "Customers can be of two types : Residential of Corporate" => you need classes Residential and Corporate that have a generalization relation to Customer.
  • "Residential customers can buy only residential services, Corporate customers allowed to buy corporate and residential services" => You need a ResidentialService and CorporateService class that have a generalization relationship to Service. In addition you can draw the relationships that are mentionned.
  • "Residential services can be prepaid or postpaid , corporate services always postpaid" => there are several ways to do this. For example: you could a class PaymendMode and a relation with Service. Add then an annotation on the link with the constraint written between { } - Another way would be to forsee classes PrepaidProduct, PostpaidProduct inheriting from PaidProduct and draw the mandatory or optional relation (using cardinalities)
  • "prepaid service can be renewed by the customer , postpaid service renewed automatically" => again, several ways to do this. One way could be to add a method renewal() to the service and clarify the special case with an anotation - Or if you opted for the payment mode hierarchy with relations, you could make a generalization relation from ResidentialService to PrepaidProduct and from BusinessService to PaidProduct, and add the interface method on the parent.
  • "3G and ADSl Services sold to Residential and Corporate Customers , iFly Service sold to residential only" => this is a trap: 3G, ADSL and iFly are objects, not classes, so they have nothing to do on a class diagram. On the other side, this could be a hint that you need a class Product that would be related to Service.

Edit: some corrections to your diagram

Your diagram should represent the inheritance in the other way round:

enter image description here

The array notation that you use to show a multivalued attribute:

enter image description here

is in fact the same as a relationship with a cardinality. Prefer the relationship:

enter image description here

For the rest, the logic seems fine to me. Except that the prepaid/postpaid in the different services: Cardinality should be 0..1 (optional) (or 1 for mandatory).

Final remark: about prepaid/postpaid: it's not clear if the service has just to indicate which payment methods are accepted (independently of the customer) or if this attribute is customer specific. If it's the latter, you should then use an association class between the customer and the relevant service (see here)

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Hello , My approach was having a customer class with 2 subclasses , residential and corporate.The Residential customer has an array of residential services , while the corporate customer has an array of services.Services class has 2 subclasses, residential service and coporate service. Each of those services classes has a prepaid and/or postpaid array . I did two separate classes which are the postpaid and prepaid with service id and payment method.Does it work? – Abdalla Ismail Jul 24 '16 at 21:19
  • 1
    When you say array are you speaking of implementation ? Or do you mean and association ? Maybe you could edit your question and show the model that you've done in the meantime so that we can review it. – Christophe Jul 24 '16 at 21:38
  • Thanks for your help , i edited the question and uploaded two pictures of my model.Please give me your opinion – Abdalla Ismail Jul 24 '16 at 22:26