Question: Write Java program Write a Java program to develop a public class Resort Catalogue that has: 1. One private attribute: resort Map as a HashMap
Write a Java program to develop a public class Resort Catalogue that has: 1. One private attribute: resort Map as a HashMap where key is a String represents country and value is a String represents resort name. [3 marks] 2. A zero-argument constructor that initializes resort Map to an empty HashMap. [2 marks] 3. A public instance method called fillMap() that takes no argument and returns nothing. It fills resortMap with the data found in a file called "resorts.txt". The file contains data as follows: [7 marks] Egypt Sharm Alsheihk Jordan Aqaba 4. A public instance method called brint () that prints resortMap one row per line. [3 marks) 5. A public instance method findResort (String name) that takes a country name as an argument and returns nothing. The method should print the resort name of that country. If country name is not founded in resortMap the method should print a message that "the country is not found in this catalogue". [6 marks] 6. Write a static main() method, and write Java statements inside the main() to do the following: [4 marks) Create an instance of ResortCatalogue class named catalogue in the main method. Use catalogue instance to call fillMap () method. Use catalogue instance to call brint () method. Use catalogue instance to print out the resort of Jordan. Hint: Import the required libraries if needed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
