Question: I need help with Java!! I was given two java files and 2 properties files (I put the code for the two files below) and
I need help with Java!!
I was given two java files and 2 properties files (I put the code for the two files below) and what I have to do is:
-------------------------------------------------------------------------------------------------------------------------------------
In this lab, we will modify an existing social network type of application called "MatchMaker" to support multiple languages.
What is MatchMaker?
"MatchMaker" is a stand-alone Java application to mimic a Web2.0 type community where members can log in, view member profiles, and find the best match based on various personalities and other aspects of member profiles. It uses a console dialog menu as the user interface. There are two menus for this entire application as below.
Home Menu - displayed when the application is first started and when the user is not logged in yet. It looks like this:
*************************** ** Welcome to MatchMaker ** *************************** 1. Login 2. Join us 0. Exit
Main Menu - displayed after a user has logged in. It looks like this:
*************************** ** Welcome to MatchMaker ** *************************** 1. Update Profile 2. View All Members 3. View Best Match 0. Exit
What do I need to do for this assignment?
1. Change the package name from "lab04" to "edu.waketech.matchmaker".
2. Add an additional properties file to support French language for the menu display. You can use Google translate to help you find the French text.
Zip up all your files and submit.
Note: You can test your program by changing your computer's Locale. For Window: https://www.java.com/en/download/help/locale.xml For MacOS: https://support.apple.com/kb/PH25082?locale=en_AU&viewlocale=en_AU
---------------------------------------------------------------------------------------------------------- package lab04; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Locale; import java.util.Properties; public class MenuHelper { public static Properties properties = new Properties();; private static final String RESOURCE_DIR = "resources"; private static String RESOURCE_FILE = "menus_en.properties"; // Default to English // Initialize the properties based on Desktop system Locale static { Locale currentLocale = Locale.getDefault(); if (currentLocale.getLanguage() != null) { String systemLanguage = currentLocale.getLanguage(); if (systemLanguage.equals(new Locale("es").getLanguage())) { RESOURCE_FILE = "menus_es.properties"; } else if (systemLanguage.equals(new Locale("fr").getLanguage())) { RESOURCE_FILE = "menus_fr.properties"; } } // Default to English File f = new File(RESOURCE_DIR + File.separator + RESOURCE_FILE); FileInputStream fis = null; try { fis = new FileInputStream(f); properties.load(fis); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (fis != null) try { fis.close(); } catch (IOException e) { e.printStackTrace(); } fis = null; } } public static final void printHomeMenu() { printWelcome(); System.out.println(); System.out.println(); System.out.println("1. Update Profile"); System.out.println(); System.out.println("2. View All Members"); System.out.println(); System.out.println("3. View Best Match"); System.out.println(); System.out.println("0. Exit"); } public static final void printMainMenu() { printWelcome(); System.out.println(); System.out.println(); System.out.println("1. Login"); System.out.println(); System.out.println("2. Join us"); System.out.println(); System.out.println("0. Exit"); } private static final void printWelcome() { System.out.println("*****************************"); System.out.println("** " + properties.getProperty("welcome") + " **"); System.out.println("*****************************"); } } ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
package lab04; public class MenuHelperMain { public static void main(String[] args) { System.out.println("------------------- Here is the home menu -------------------"); MenuHelper.printHomeMenu(); System.out.println(); System.out.println(); System.out.println("------------------- Here is the main menu -------------------"); MenuHelper.printMainMenu(); } } PROPERTIES FILES PROVIDED
1. menus_es.properties
--------------------------------------------------------------
welcome=Bienvenido a MatchMaker login=Iniciar sesin join=nete a nosotros exit=salida update_profile=Actualizacin del perfil view_all_members=Ver todos los miembros view_best_match=Ver el mejor partido
-------------------------------------------------------------------------------
2. menus_es.properties
--------------------------------------------------------------------------------
welcome=Welcome to MatchMaker login=Log in join=Join us exit=Exit update_profile=Update Profile view_all_members=View All Members view_best_match=View Best Match
---------------------------------------------------------
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
