Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 year it was founded. It also has two constructors: (1) one without input parameters and (2) a second one that takes the name and the year. The class City has getters and setters for the name and the foundation year. It also has two additional methods: (1) calculate Population that returns the amount (i.e., number) of people living in the city and (2) addResident that takes a Person as input parameter and add that person to the population ArrayList. The class Address has three private final attributes: (1) a string representing the street, (2) an integer representing the street number, and (3) a string representing the postal code. The class Address has only one constructor that takes the three attributes as input parameters. It also has a toString method. The class Person has three attributes: (1) name, (2) age, and (3) address. The class comes with two constructors. The first constructor takes the name and the age and sets the address to null. The second constructor takes the name, the age, and an object of type Address. The class person has getters for the three attributes. It also has a setter for the address. The classes Minor and Adult inherit from Person. The class Minor has an additional attribute: guardian that is of type Adult. This attribute represents who is the guardian for 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. The class Adult also has an additional attribute. However, in this case, the attribute is a boolean attribute called ward. This attribute represents if there are minors that are under the supervision of the adult. The class Adult has a constructor that initialize all the attributes in the superclass and the class itself. The class provides a setter method for the ward attribute. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Analyse the process of new product of development.

Answered: 1 week ago

Question

Define Trade Mark.

Answered: 1 week ago

Question

=+Where do you want to live and work?

Answered: 1 week ago