Question: Solve using java language Given the following UML diagram: Part 1: Implement the following classes: Note that some roads have a carpool lane which is

Solve using java language

Solve using java language Given the following UML diagram: Part 1: Implement

Given the following UML diagram: Part 1: Implement the following classes: Note that some roads have a carpool lane which is restricted for peak travel times or longer for the use of vehicles with a driver and one or more passengers. Road - speedLimit: int - length: int - carpool: boolean + Road(----All Parameters----) + setters/getters +toString(): String Country - name: String - roads: ArrayList + Country(name: String) DetName(): String + addFreeway(f: Freeway): void + addStreet(s: Street): void + getRoads(): ArrayList + countStreets(): int + countFreeways With Carpool(): 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 Part 2: Implement a driver class (main class) as follows: 1. Create a country object with name read from the user. 2. Add to the country object some freeways and streets as many as the user wants 3. Display the number of streets in the country object using the corresponding method in the Country class. 4. Count the freeways which have a carpool lane using the corresponding method in the Country class. 5. Test the searchForStreet method by reading a street name from the user and displaying its description if it is available. 6. Display the description of all streets only

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!