How to draw a class diagram correctly?

0 votes
asked Feb 19 in Question / help by jhon6493 (120 points)

How to draw a class diagram correctly?
If required, I can draw it in Visio or another program.
Diagram in the online editor: https://www.plantuml.com/plantuml/uml/VP71IWCn443l-OevjaZx0KMaseC85Znu4m_3PimEpKxAP5PPr7ytYsPT3sikERoyUJ3PPqErleikdrZEgDX1P24RpWH9hKtEDH5pXWTDOQJl3igvW2Eoh513ta4sPGbFp-iTl2RsxhCwnoGqt61pcgnRiWEgVopZL-jgpfYIPxldZct4BFRBhaLwZ8UsDAd2KdBb9dt1Xk3kMny39RYSMuxzdvhFlzpuz2QRQIr_uSSFdHRWwhkjScXjUpL3Un9VVk0B

**Program**
```cs
class Program
{
    static void Main(string[] args)
    {  
        ICreditCard creditCard = new MoneyBack();
        Console.WriteLine("CardType : "    + cardDetails.GetCardType());
        Console.WriteLine("CreditLimit : " + cardDetails.GetCreditLimit());
        Console.WriteLine("AnnualCharge :" + cardDetails.GetAnnualCharge());
    }
}
```

**ICreditCard**
```cs
public interface ICreditCard
{
    string GetCardType();
    int GetCreditLimit();
    int GetAnnualCharge();
}

```

**MoneyBack**
```cs
public class MoneyBack : ICreditCard
{
    public string GetCardType()
    {
        return "MoneyBack";
    }
    public int GetCreditLimit()
    {
        return 15000;
    }
    public int GetAnnualCharge()
    {
        return 500;
    }
}
```

solution1

```puml
@startuml
skinparam linetype ortho

class Program {
    + Main(args: string[]): void
}

class MoneyBack {
    + GetCardType(): string
    + GetCreditLimit(): int
    + GetAnnualCharge(): int
}

interface ICreditCard {
  + GetCardType(): string
  + GetCreditLimit(): int
  + GetAnnualCharge(): int
}

ICreditCard <-down- Program
ICreditCard <|-down- MoneyBack
Program .right.> MoneyBack
@enduml
```

Solut-1

Solut-2



Solut-3


Solut-4

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...