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
Make The PYTHON Code<br><br> print first 3 character of a string - given "Seattle" expected "Sea"
vlada-n [284]

This program uses a conditional to determine if seafood is safe to consume.

IF (seafood = "mollusk" OR daysFrozen ≥ 7) { rating ← "safe" } ELSE { rating ← "unsafe" }

In which situations will rating be "safe"?

️Note that there may be multiple answers to this question.

Choose all answers that apply:Choose all answers that apply:

1. When sea food is mollusk and day frozen is 1

2.When sea food is mollusk and day froze is 9

3. When see food salmon and day frozen is 7

<em>Did that help?</em>

6 0
2 years ago
​In terms of e-commerce infrastructure, the Web server's required amount of storage capacity and computing power depends primari
Tamiku [17]

Answer:

Option A is correct

Explanation:

The computing power of a web server and the storage capacity mostly depend on the software that run the server and the volume of e-commerce transactions.

8 0
4 years ago
Read 2 more answers
4.8 code practice question 2
Anna35 [415]

Answer:

Written in Python

for count in range(88, 42,-2):

    print(count,end=' ')

Explanation:

The programming language is not stated.

However, I used python to answer the question.

First, we need to loop from 88 to 44 with a difference of -2 in each term.

This is implemented as

for count in range(88, 42,-2):

Which means to start at 88 and ends at 42 - (-2) which is 44 with an increment of -2

Next, is to print the current iterating value;

This is implemented using print(count)

However, since all values are to be printed on a line, there's a need t modify the statement as: print(count,end=' ')

4 0
3 years ago
Why is computer called information processing machine....?​
mixer [17]

Answer:

Since the computer accepts raw data as input and converts into information by means of data processing

Explanation:

helping!!!

3 0
2 years ago
Read 2 more answers
Which steps will import data from an Excel workbook? Use the drop-down menus to complete them.
vlada-n [284]

Answer:

what are the blank options

4 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the file names below follows standard file naming convention?
    12·2 answers
  • When applying a filter to a text layer, how can you ensure that the types editability is not lost
    12·1 answer
  • On the topic of "Bridging the Digital Divide", why should companies consider the digital divide?
    9·1 answer
  • Are the blank space around the edges of the page
    5·1 answer
  • Mathematics and computer science share many concepts.
    5·2 answers
  • Write a program to Test if mold is stored in the variable word.
    5·1 answer
  • What is a BUG in terms of computer programming?
    7·1 answer
  • Peter has recently bought a media player and a digital camera. He wants to buy a memory card for these devices. Which memory dev
    11·1 answer
  • Location of a video or photoshoot is not important when it comes to preplanning the shoot
    15·1 answer
  • What are the uses of navigation keys​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!