1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sever21 [200]
3 years ago
13

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 d

ate 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. 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.
Computers and Technology
1 answer:
rosijanka [135]3 years ago
6 0

Answer:

The Java code is given below with appropriate comments as well as the sample output

Explanation:

import java.util.Scanner;

public class Main

{

  public static void main(String[] args) {

System.out.println("Enter a date in the form mon/day/year:");

Scanner scanner = new Scanner(System.in);

String inputDate = scanner. nextLine();

 

//Split the string string with / as the delimiter

String[] dateComponents = inputDate.split("/");

 

//Rearrange the date and month part and join with '.' as sepertor

String outputDate = String.join(".", dateComponents[1], dateComponents[0], dateComponents[2]);

 

System.out.println("Your date in European form is:\n" + outputDate);

  }

}

<u>Sample Output </u>

Output 1:

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

01/22/2020

Your date in European form is:

22.01.2020

Output 2:

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

1/22/20

Your date in European form is:

22.1.20

You might be interested in
What aspect should you consider before adding pictures to a document?
Luden [163]

Answer:

information?

Explanation:

picture are there to give a visual or make the document more appealing. if your wording and information isnt up to date or reasonable people wont lean to what you are saying as much.

8 0
2 years ago
Read 2 more answers
The ____, or typeface, defines the appearance and shape of letters, numbers, and special characters.
Paladinen [302]
Font(s)
fonts is another word for typeface
the appearance of letters and numbers when you chang the font
5 0
3 years ago
You can be sentenced to up to 180 days in jail for driving with a license that was suspended for _________ .
Yanka [14]

Answer:c\

Explanation:

4 0
3 years ago
What is a good coding site
Helga [31]

Sratch.com

-Agarvated

6 0
3 years ago
What is a cell address in xsl sheet
fgiga [73]

Answer:

cell address is the exact location of a particular cell of ms-excle

Explanation:

A1 refers to first row and first column.

A2 refers to second row first column.

i.e.

in 'A1' : 'A' indicate column { A= first column, B= second

column, C= third column. and soon.....}

'1' indicate row { 1 = first row, 2 = second row, 3= third row..... soon .......}

5 0
3 years ago
Other questions:
  • Zara is designing a slide with a numbered label on a picture. She wants the number to appear when the she presses a button on th
    11·2 answers
  • A virtual private network (VPN) is used to securely connect to another network over a insecure network.
    9·2 answers
  • Which of the following are valid values for a boolean value in programming? (Select all that apply)
    8·1 answer
  • Nathan wants to create multiple worksheet containing common formatting styles for his team members. Which file extension helps h
    9·1 answer
  • Yolanda first breaks down the whole game she needs to program into modules. She then breaks these modules into smaller modules u
    11·1 answer
  • Drag the correct type of update to its definition.
    13·1 answer
  • What is the best stratiget to avoid paying intrest in your credit cared
    13·1 answer
  • How should excel Identify social security numbers: as a text, numbers, or date and time? Why?
    11·2 answers
  • SHA-1 produces a(n) ___________-bit message digest, which can then be used as an input to a digital signature algorithm.
    5·1 answer
  • Answer the following 8-mark question in your book.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!