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
Which is considered to be the oldest form of social media? A. media-sharing sites B. location-based services C. social networkin
neonofarm [45]

Answer:

b location based services

Explanation:

:)

4 0
3 years ago
In a computer-controlled greenhouse, a temperature sensor and a window motor are connected to the computer.
GrogVix [38]
Hope this helps solve it

8 0
2 years ago
Which of these is a cultural form? A. Art B. Food C. Clothes D. All of the above
wel
D. All of the above


Sorry If Wrong
4 0
3 years ago
Read 2 more answers
Suppose that, even unrealistically, we are to search a list of 700 million items using Binary Search, Recursive (Algorithm 2.1).
damaskus [11]

Answer:

There is also an attachment below

Explanation:

Since we are talking about binary search, let's assume that the items are sorted according to some criteria.

Time complexity of binary search is O(logN) in worst case, best case and average case as well. That means it can search for an item in Log N time where N is size of the input. Here problem talks about the item not getting found. So, this is a worst case scenario. Even in this case, binary search runs in O(logN) time.

N = 700000000.

So, number of comparisions can be log(N) = 29.3 = 29.

So, in the worst case it does comparisions 29 times

7 0
3 years ago
Implement the function first chars() that takes a list of strings as a parameter and prints to the screen the first character of
Fiesta28 [93]
Def firstChars( word ):
   if( word ): # make sure word has characters
       print( word[ 0 ] ) # print the first character (Python 3 syntax)
3 0
3 years ago
Other questions:
  • True or False, PDF documents have many benefits, but their main disadvantage is that the formatting of their text and graphic el
    15·1 answer
  • You run an automobile selling company that has a popular online store on AWS. The application sits behind an Auto Scaling group
    6·1 answer
  • Sanjay is giving a slideshow presentation on his entire college class and he is feeling quite nervous in order to share his pres
    9·1 answer
  • Write a program that ask the user to enter air water or Steele and the distance that a sound wave will travel in the medium the
    6·1 answer
  • How can you remove heat from a computer?
    10·1 answer
  • Read each statement below. If the statement describes a peer-to-peer network, put a P next to it. If the statement describes a s
    12·1 answer
  • Can anyone please help me to solve this question?
    10·1 answer
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • Implement a simplified version of a crypto broker platform. Initially, there is an array of users, with each user depositing onl
    8·1 answer
  • Which is true for comments? Group of answer choices The compiler does not generate machine code for comments. The compiler conve
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!