Week 7 Assignment: Manage a list of countries Console
Welcome to the Country Manager
1 - List countries
2 - Add a country
3 - Exit
Enter menu number: 1
India
Japan
Mexico
Spain
United States
1 - List countries
2 - Add a country
3 - Exit
Enter menu number: 2
Enter country: France
France has been added.
1 - List countries
2 - Add a country
3 - Exit
Enter menu number: 1
France
India
Japan
Mexico
Spain
United States
1 - List countries
2 - Add a country
3 - Exit
Enter menu number: 3
Goodbye!
Operation
· The application begins by displaying a menu with three menu items.
· If the user chooses the first item, the application displays a list of countries that are stored in a database.
· If the user chooses the second item, the application prompts the user to enter a country and then it adds that country to the database.
· If the user chooses the third item, the application displays a goodbye message and exits.
Week 7 Assignment: Manage a list of countries (cont.) Specifications
· Create a table in the mma database described in chapter 19 to store the necessary data. To do that, you can use the SQL script stored in the create_country_table.sql file that’s supplied. If this script isn’t supplied, you can create your own SQL script.
· Create a class named CountryDB that contains two methods: one that allows you to read a list of countries and another method that allows you to add a country to the list. For example:
public ArrayList<String> getCountries()
public boolean addCountry(String country)
· Create a class named CountryApp that displays the menu and responds to the user’s choices.
· Use the Console or a variation of it to get the user’s entries.
· Modify the application so it allows the user to delete a country from the database.