Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please complete the following: Create a Main class with the main ( ) method which shows a menu of options for the user to choose

Please complete the following:
Create a Main class with the main
(
)
method which shows a menu of options for the user to choose from. It shows the following screen and calls the chosen method as listed; then the menu appears again, repeat until the user types
3
to quit:
Menu
1
.
Countries and Capitals
displays a list of countries and capitals
2
.
Countries Info
displays the info returned by the
4
functions of the CountryProcessor class.
3
.
Exit
terminates the menu loop
In a class called CountryList, displays all countries and their capitals in a JList
(
e
.
g
.
Canada: Ottawa
)
,
in alphabetical order by country name. Use the data from the countries
-
and
-
capitals.txt file. When the user closes the window, show the Main.main
(
)
menu.
In a class called CountryProcessor, create a function named processCountries
(
)
that calls all
4
functions. Use the data from the countries
-
and
-
capitals.txt file.
Create a HashMap instance variable with country name as key, and its capital city name as value
(
e
.
g
.
"Canada": "Ottawa"
)
.
Use streams and filters to create the following functions which do exactly what they say. In all cases, before printing, collect the result into a java collection or local variable
(
e
.
g
.
List, String, Integer, etc...
)
:
1
.
printNumberOfCountries
(
)
2
.
printLongestCapitalCity
(
)
3
.
printShortestCountryName
(
)
4
.
printAllCountriesStartingWith
(
String substring
)
JUnit
create unit tests to test the above
4
functions.
Create and upload
(
as pdf
)
the UML Class diagram showing the classes with their attributes, methods and relationships.
Page
3
of
3
November
2
0
2
3
Main class
main
(
)
shows a menu of
3
options: the menu repeats until the user choice is exit.
CountryList class
display all countries and capitals in a JList in alphabetical order by CountryName. Use countries
-
and
-
capitals.txt
CountryProcessor class
use countries
-
and
-
capitals.txt
processCoutries
(
)
calls
4
functions
-
HashMap instance country name
(
key
)
/
capital city
(
value
)
-
Use streams and filters to create a collection and print it
,
for each of the functions:
-
printNumberOfCountries
(
)
-
printLongestCapitalCity
(
)
-
printShortestCountryName
(
)
-
printAllCountriesStartingWith
(
String substring
)
Create Unit tests for the
4
methods.
Create the UML class diagram

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

Step: 3

blur-text-image

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

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions

Question

Is this issue more complex than it seems?

Answered: 1 week ago

Question

=+how might their legitimacy be improved?

Answered: 1 week ago