Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement a Register (which should be fully document with Javadoc, i.e. class header, constructor/method description and tags where appropriate) class that should represent an aggregation

image text in transcribed

implement a Register (which should be fully document with Javadoc, i.e. class header, constructor/method description and tags where appropriate) class that should represent an aggregation of names.

a) The Register class (in src > lib) should have two fields - an ArrayList of type Name, and an int, which represents a hypothetical room capacity used to determine the number of names a register can hold. There should be a default constructor, which sets room capacity to 20, and a custom constructor that allows the room capacity to be provided. There should be a get method for the room capacity, but not a set method, i.e. it can only be set at the point of construction.

b) Methods should allow names to be added, removed and retrieved from the register. It should also be possible to retrieve the register's size, clear all entries within it and check if it is empty. A toString() method should be in the standard convention format.

c) The addName method (which accepts a single Name) should ensure room capacity is not exceeded. There should also be an addNames method that accepts an ArrayList and adds each of these names to the register, so long as room capacity is not exceeded. Both operations should do nothing if room capacity would be breached.

d) Add a method searchRegisterByFirstNameInitial(...) that accepts a char argument and returns true or false depending on whether the register contains a first name that starts with the character provided.

e) Add a method countFirstNameOccurrences(...) that accepts a String argument and returns an int signaling the number of occurrences of first names in the register that Notes - UML class diagrams: Fields that form a composition or aggregation relationship will not be listed explicitly and are instead implied by the relationship itself. Therefore in EmployeeRegister above, there was no need to specify a field: "list : ArrayList" because there is an aggregation relationship that already implies that EmployeeRegister holds a collection of type Employee. Having viewed composition and aggregation relationships individually, the same principles can be reapplied to create more complex systems consisting of multiple classes and associations match the string provided (regardless of case i.e. this check is not case-sensitive).

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

Microsoft Office 365 For Beginners 2022 8 In 1

Authors: James Holler

1st Edition

B0B2WRC1RX, 979-8833565759

More Books

Students also viewed these Databases questions