Simple class diagram showing error at line 46

0 votes
asked Oct 3, 2023 in Question / help by aks2161989 (120 points)
So I am trying to create a simple class diagram. The code is as follows:

@startuml

class InsurancePolicyRegister{
string companyName
ArrayList<InsurancePolicy> insurancePolicyList
addPolicy()
deletePolicy()
updatePolicy()
}

class InsurancePolicy {
Person policyHolder
Person secondDriver
float premiumAmount
string startDate
string endDate
 ArrayList<Car> carList
 float maxCoverageLimit
}

class Car {
string VIN
string make
string model
int year
}

class Person {
string firstName
string lastName
string dateOfBirth
string SSN
Address  homeAddress
Address workAddress
Address localAddress
}

class Address{
string line1
string line2
string city
int zip
string state
}

InsurancePolicyRegister *--> InsurancePolicy *--> Car
InsurancePolicy *--> Person *--> Address

@enduml

(sorry couldnt find ther code formatting button)

Generating a diagram fails with the message "Error line 46 in file: CodeForPlantUML.txt
Some diagram description contains errors"

What is wrong in my code?

1 Answer

0 votes
answered Oct 3, 2023 by albert (3,540 points)

As far as I can tell the lines:

InsurancePolicyRegister *--> InsurancePolicy *--> Car
InsurancePolicy *--> Person *--> Address

are not correct and should be split into:

InsurancePolicyRegister *--> InsurancePolicy
InsurancePolicy *--> Car
InsurancePolicy *--> Person
Person *--> Address

The "Code Formatting button is a bit hidden, it is the word "Formatted" under the "button" / "drop down" that by default reads "Normal" (3rd button on second row next to "Font" and "Size")

...