Question: Write the UML diagram that represents a program with the following description. You can (1) use any software tool or (2) draw it by hand

Write the UML diagram that represents a program with the following description. You can (1) use any software tool or (2) draw it by hand and submit a picture. If you draw it by hand, it should be readable and clear. UML diagram notation must be followed. Description: The software is made of five classes named: City, Address, Person, Minor, and Adult The class City has 3 attributes: (1) a name represented by a string, (2) the population represented by an ArrayList of objects of type Person, and (3) an id represented by an integer. The id is generated automatically, therefore, the class also comes with a class attribute (i.e., static) named id Counter and initialized with O. It has a constructor that takes the name of the city and initializes all attributes. The population is set to an empty array list. The class City has getters for all the attributes except for idCounter . It also has two additional methods: (1) calculate Population that returns the amount (i.e., number) of people leaving in the city and (2) addResident that takes a Person object as input parameter. The method checks if that person is already in the population and if it is not there, it adds that person to the population ArrayList. The class Address has two attributes: (1) a string representing the street and the street number, and (2) a string representing the postal code. The class Address has two constructors: (1) a default constructor with no input parameters and (2) a constructor that takes the two attributes as input parameters. It also has a toString method and getters and setters for all attributes. The class Person has three attributes: (1) name, (2) age, and (3) address. The class comes with a single constructor that takes the name, the age, and an object of type Address. The class person has getters and setters for all attributes. The class Person has three attributes: (1) name, (2) age, and (3) address. The class comes with a single constructor that takes the name, the age, and an object of type Address. The class person has getters and setters for all attributes. The classes Minor and Adult inherit from Person. The class Adult has an additional attribute: ward that is of type ArrayList of Minor. This attribute represents who are the minors the adult supervises. An adult can supervise more than one minor. The class Adult has a constructor that initialize all the attributes in the superclass and the class itself. The class provides getter and setter methods for the attribute ward. The class Minor also has an additional attribute. However, in this case, the attribute is a Boolean name guardian and it represents if the is an adult supervising the minor. The class Minor has a constructor that initialize all the attributes in the superclass and the class itself. The class provides getter and setter methods for the attribute guardian. Notes: 1. If the data types are not specified you need to select the most appropriate one. 2. If the visibility of the method/attribute is not specified, you need to select the most appropriate visibility 3. For full marks, appropriate arrows defining the relationships between the classes must be provided Write the UML diagram that represents a program with the following description. You can (1) use any software tool or (2) draw it by hand and submit a picture. If you draw it by hand, it should be readable and clear. UML diagram notation must be followed. Description: The software is made of five classes named: City, Address, Person, Minor, and Adult The class City has 3 attributes: (1) a name represented by a string, (2) the population represented by an ArrayList of objects of type Person, and (3) an id represented by an integer. The id is generated automatically, therefore, the class also comes with a class attribute (i.e., static) named id Counter and initialized with O. It has a constructor that takes the name of the city and initializes all attributes. The population is set to an empty array list. The class City has getters for all the attributes except for idCounter . It also has two additional methods: (1) calculate Population that returns the amount (i.e., number) of people leaving in the city and (2) addResident that takes a Person object as input parameter. The method checks if that person is already in the population and if it is not there, it adds that person to the population ArrayList. The class Address has two attributes: (1) a string representing the street and the street number, and (2) a string representing the postal code. The class Address has two constructors: (1) a default constructor with no input parameters and (2) a constructor that takes the two attributes as input parameters. It also has a toString method and getters and setters for all attributes. The class Person has three attributes: (1) name, (2) age, and (3) address. The class comes with a single constructor that takes the name, the age, and an object of type Address. The class person has getters and setters for all attributes. The class Person has three attributes: (1) name, (2) age, and (3) address. The class comes with a single constructor that takes the name, the age, and an object of type Address. The class person has getters and setters for all attributes. The classes Minor and Adult inherit from Person. The class Adult has an additional attribute: ward that is of type ArrayList of Minor. This attribute represents who are the minors the adult supervises. An adult can supervise more than one minor. The class Adult has a constructor that initialize all the attributes in the superclass and the class itself. The class provides getter and setter methods for the attribute ward. The class Minor also has an additional attribute. However, in this case, the attribute is a Boolean name guardian and it represents if the is an adult supervising the minor. The class Minor has a constructor that initialize all the attributes in the superclass and the class itself. The class provides getter and setter methods for the attribute guardian. Notes: 1. If the data types are not specified you need to select the most appropriate one. 2. If the visibility of the method/attribute is not specified, you need to select the most appropriate visibility 3. For full marks, appropriate arrows defining the relationships between the classes must be provided
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
