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 (name the file as DateChange.java) 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.
For this question, you are NOT allowed to use the split method in the String class.
Please note that users are allowed to input the year in two digits or four digits, and
input the month and day in one digit or two digits. Your program should be able to
handle all possible cases.
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 to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

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

Question

please dont use chat gpt AI 9 7 0

Answered: 1 week ago

Question

What is the principle of thermodynamics? Explain with examples

Answered: 1 week ago

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago