Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the United States, we commonly express dates by listing the month, then the day then the year, all separated by slash marks. In Europe,

In the United States, we commonly express dates by listing the month, then the day then the year, all separated by slash marks. In Europe, however, dates are commonly expressed by listing the day first, then the month, then the year, all separated by periods.

Write a JAVA application program that will get a line of text containing a date in US form from the user, and then change this date to European form.

Begin by asking the user to enter a date in the form of month/day/year. Store this date in a String variable.

Next, use the appropriate String methods to swap the month and day parts of the date, and replace the slash marks with periods. Print the revised String to the screen.

The following is an example of what you might see on the screen when your program runs. The exact output depends on the values that the user types in while the program runs. The user's values are shown below in italics:

Enter a date in the form mon/day/year:

06/17/2008

Your date in European form is:

17.06.2008

Here is another example run:

Enter a date in the form mon/day/year:

5/3/09

Your date in European form is:

3.5.09

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions