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
You should always be afraid to use the internet<br><br> True or false?
ch4aika [34]

Answer:

false

Explanation:

you should be but in the same time no

7 0
3 years ago
Altering grade records within a computer system is called
Cloud [144]
Altering grade records within a computer system is called forgery. The correct option among all the options given in the question is option "a". Any kind of altering using the computer without the consent of the proper authorities amounts to forgery. Forgery is a crime and a person can be jailed for such a serious offense.
4 0
3 years ago
Read 2 more answers
An IT security threat is anything that might cause serious harm to a computer system.
Blababa [14]

Answer:

True

Explanation:

this is true because a threat can endanger the computer and its system

5 0
2 years ago
Create a 4x5 matrix with ones everywhere and zeros on the last row.
Stells [14]

Answer:

#include <iostream>

using namespace std;

int main() {

   int a[4][5];//declaring a matrix of 4 rows and 5 columns.

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       {

           if(i==3)//initializing last row as 0.

           {

               a[i][j]=0;

           }

           else//initializing last row as 1.

           {

               a[i][j]=1;

           }

       }

   }

   for(int i=0;i<4;i++)

   {

       for(int j=0;j<5;j++)

       cout<<a[i][j]<<" ";//printing the matrix.

       cout<<endl;

   }

return 0;

}

Output:-

1 1 1 1 1  

1 1 1 1 1  

1 1 1 1 1  

0 0 0 0 0

Explanation:

I have created a matrix of size 4 rows and 5 columns.I have used for loops to fill the array.To fill the last row with 0 i have used if statement.else we are filling it with 1.

7 0
3 years ago
Meats ages hair and feathers all contain this monomer
OverLord2011 [107]

Answer:Amino Acid

Explanation:

All proteins have amino acids

7 0
3 years ago
Other questions:
  • What are six external parts of a computer
    11·1 answer
  • What's the best way to change the font size of all your notes pages at once?
    6·1 answer
  • Provide examples of the cost of quality based on your own experiences
    14·1 answer
  • You are running out of storage space on one of your servers. you need to purchase an external hard drive, as there are no drive
    8·2 answers
  • What are finger nails made of?-
    12·2 answers
  • A company has critical systems that are hosted on an end-of-life OS. To maintain operations and mitigate potential vulnerabiliti
    14·1 answer
  • Which part of a touchscreen responds to pressure applied to its surface?
    6·1 answer
  • A user reports that nothing happens when he or she attempts to print from the computer at his desk. This points to a possible pr
    15·1 answer
  • What does running the “sudo” command do?
    6·1 answer
  • Website managers use____ every day.
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!