Question: Given reference, useful methods for accessing Java class ArrayList: add (elt): Add element to the end of the list, e.g. arrList.add(elt) get (index): Get an

 Given reference, useful methods for accessing Java class ArrayList: add (elt):Add element to the end of the list, e.g. arrList.add(elt) get (index):

Given reference, useful methods for accessing Java class ArrayList: add (elt): Add element to the end of the list, e.g. arrList.add(elt) get (index): Get an element (with index) in list, e.g. arrList.get(0) size(): Size (total number of elements of the list, e.g arrList.size() Based on the given references above and the class City in the last question define a new Java class BCity for modeling Better" Cities with the following requirements. a) This BCity class is a public subclass of the given class City This class has a specific instance field named bRList (type ArrayList of string) representing the list of better rules (of string type) governing the better city. This field is initialized with an empty ArrayList of string. b) It has one constructor with 3 parameters ( String cN, int cP. String [ ] rules): The first and second parameters are for the name and population of the city object, while the the third parameter is for the rules. The body of this constructor first calls the corresponding constructor of its superclass with the two related input parameters. The constructor body then adds all elements of the input array parameter into its own specific field bRList

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!