Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Run and debug your JAVA file to ensure that your solution works.

Here is the code:

/********************************************************************** * 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 * 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));

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions