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
Why will it take so long to complete the high-speed rail route?
koban [17]
It will take a while for all of the necessary safety inspections. 
3 0
3 years ago
Read 2 more answers
I need help with this problem please
alina1380 [7]

Answer:

i think its d

8 0
3 years ago
in what way do rules and laws created to address public problems affect individuals groups and business
Anika [276]

Answer:

Explanation:

bussnise

4 0
3 years ago
What is an input to the Program Increment Planning process that highlights how Product Management plans to accomplish the Vision
Tatiana [17]

Answer:

Business Context

Explanation:

The input "business context" is an input to Program Increment Planning that helps understand what is the vision in Product Management.

6 0
3 years ago
An elevator of mass 250kg is carrying two persons whose masses are 50kg and 100kg. if the force exerted by the motor is 3000N. C
Agata [3.3K]

m_{elevator}=250kg \\m_{people}=50kg+100kg=150kg \\m_{motor}\approx3000N\div10\frac{m}{s^2}\approx300kg \\m_{total}\approx250kg+150kg+300kg\approx\boxed{700kg}

Hope this helps.

r3t40

5 0
3 years ago
Other questions:
  • [Edhesive] 4.1 Code Practice
    5·2 answers
  • What are the differences between message confidentiality and message integrity? Can you have confidentiality without integrity?
    9·1 answer
  • What does the Auto Fill tool do?
    15·2 answers
  • What is required for real-time surveillance of a suspects computer activity?/p Group of answer choices a. Blocking data transmis
    12·1 answer
  • Kevin has to decide on a financial service provider that will help him with his needs related to tax exemptions and payments. He
    10·1 answer
  • What is the biggest difference between technical communication and the other kinds of writing you have done?
    13·1 answer
  • __________ is a protocol used by e-mail clients to download e-mails to your computer.
    14·1 answer
  • How do you check how much space is left in current drive?
    9·1 answer
  • Firewall ____ indicate whether a large number of echo messages are being received.
    9·1 answer
  • ¿Qué algoritmos de encriptación utilizan una clave para cifrar los datos y una clave diferente para descifrarlos?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!