Answered step by step
Verified Expert Solution
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 to quit:
Menu
Countries and Capitals displays a list of countries and capitals
Countries Info displays the info returned by the functions of the CountryProcessor class.
Exit terminates the menu loop
In a class called CountryList, displays all countries and their capitals in a JList eg Canada: Ottawa in alphabetical order by country name. Use the data from the countriesandcapitals.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 functions. Use the data from the countriesandcapitals.txt file.
Create a HashMap instance variable with country name as key, and its capital city name as value eg "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 eg List, String, Integer, etc...:
printNumberOfCountries
printLongestCapitalCity
printShortestCountryName
printAllCountriesStartingWithString substring
JUnit create unit tests to test the above functions.
Create and upload as pdf the UML Class diagram showing the classes with their attributes, methods and relationships.
Page of November
Main class
main shows a menu of 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 countriesandcapitals.txt
CountryProcessor class use countriesandcapitals.txt
processCoutries calls functions
HashMap instance country name keycapital city value
Use streams and filters to create a collection and print it for each of the functions:
printNumberOfCountries
printLongestCapitalCity
printShortestCountryName
printAllCountriesStartingWithString substring
Create Unit tests for the methods.
Create the UML class diagram
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started