Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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) the country where the city is located. It also has two constructors: (1) one without input parameters and (2) a second one that takes the name and the country. The class City has getters and setters for all the attributes. 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 name, age, and address object as input parameters, creates a Person object and add that person to the population ArrayList. The class Address has two private final attributes: (1) a string representing the street and the street number, and (2) a string representing the postal code. The class Address has only one constructor that takes the two attributes as input parameters. It also has a toString method and getters for all attributes. The class Person has three attributes: (1) fullName, (2) age, and (3) address. The class comes with a single constructor that takes the name, the last name, the age, and an object of type Address. The constructor concatenates name and last name and assigns the result to fullName. The class person has getters for fullName and address. It also has a setter for the address and age. The classes Minor and Adult inherit from Person. The class Adult has an additional attribute: ward that is of type Minor. This attribute represents who is the minor the adult supervises. An adult can only supervise a 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 called 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started