Question: Implement the class Country only. The code of the classes Road, Street and Freeway is provided below. Road - speedLimit: int - length: int -

 Implement the class Country only. The code of the classes Road,

Implement the class Country only. The code of the classes Road, Street and Freeway is provided below. Road - speedLimit: int - length: int - carpool: boolean + Road ---All Parameters----) + setters/getters +toString(): String Country - name: String - roads: ArrayList + Country(name: String) + getName(): String + getRoads(): ArrayList + add Road(r: Road): void + countStreets(): int + searchForStreet((streetName: String): Street + toString(): String Street - name: String + Street (----All Parameters----) + setter/getter + toString(): String Freeway - code: int + Freeway(---All Parameters----) + setter/getter + toString(): String A. Implement the class country. Write the following methods: a) A constructor to initialize the name and create the arrayList roads. b) The methods getName() and getRoads(). c) The coutStreets method that returns the number of streets in the array list. d) The searchForStreetmethod that takes as parameter the name of a street and returns the street object if found or null if not found. e) A toString method to return information about all data fields

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!