/**********************************************************************
* Program: Startercode
* Purpose: Class assignment:
* Students - Given starter code, students write code that uses the
* Locale object (language, country, etc.) *
* The questions marks (?) in the code are to be completed by the students.
* Add comments/documentation to the code lines
* Programmer: Iam A. student
* Class: PRG/421r13, Java Programming II
* Instructor: XXXXX
* Creation Date: TODAY'S DATE
*
* Comments:
* For additional information, refer to:
* OCA/OCP Java SE7, Programmer I & II Study Guide
* Chapter 8: String Processing, Data Formatting, Resource Bundles
* Section: Working with Dates, Numbers, and Currencies
*
***********************************************************************/
package code;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Date;
import java.util.__?__;
public class Startercode {
public static void main(String[] args) {
long number = 5000000L;
NumberFormat numberFormatDefault = NumberFormat.getInstance();
System.out.println("Number Format using Default Locale: "+numberFormatDefault.format(number));
NumberFormat numberFormatLocale = NumberFormat.getInstance(Locale.__?__);
System.out.println("Number Format using _?__Locale: "+numberFormatLocale.format(number));
NumberFormat numberFormatDefaultCurrency = NumberFormat.getCurrencyInstance();
System.out.println("Currency Format using Default __?__:
"+numberFormatDefaultCurrency.format(number));
NumberFormat numberFormatLocaleCurrency = NumberFormat.getCurrencyInstance(Locale.__?_);
System.out.println("Currency Format using __?__ Locale: "+numberFormatLocaleCurrency.format(number));
Currency currency = Currency.getInstance(L___? . ___?__);
System.out.println(currency.getDisplayName()+" ("+currency.getCurrencyCode()+")
"+currency.getDisplayName());
Date currentDate = new Date();
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, Locale.__?__);
System.out.println("Date Format in __?__ Locale: "+dateFormat.format(currentDate));
}
}
For this assignment, you will develop Java code that relies on localization to format currencies and dates.
In NetBeans, copy the linked code to a file named "Startercode.java".
Read through the code carefully and replace all occurrences of "___?___" with Java code.
Note: Refer to "Working with Dates and Times" in Ch. 5, "Dates, Strings, and Localization," in OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide for help.
Run and debug your JAVA file to ensure that your solution works.