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
Sauron [17]
3 years ago
15

Write a program that asks the user to enter two dates (in YYYY-MM-DD format), and then prints which date is earlier. Your progra

m should print an error message if the user enters an invalid date (like 2019-15-99).
Computers and Technology
1 answer:
Dafna11 [192]3 years ago
4 0

Answer:

import java.util.*;

public class Dates {

   public static void main(String[] args) {

       String January,February, March, April, May, June, July,  

       August, September,October, November, December, month;

       January = February = March = April = May = June = July =  

               August = September = October = November = December = month = null;

       Scanner myScanner = new Scanner(System.in);  

       System.out.print("Enter date in the format mm/dd/yyyy: ");

       String input = myScanner.next();

       String months = input.substring(0,1);

       int monthInt = Integer.parseInt(months);

       if (monthInt == 01){

           month = January;

       }

       else if (monthInt == 02){

           month = February;

       }

       else if (monthInt == 03){

           month = March;

       }

       else if (monthInt == 04){

           month = April;

       }

       else if (monthInt == 05){

           month = May;

       }

       else if (monthInt == 06){

           month = June;

You might be interested in
Jhon bought a new printer for his desktop computer. It does not work even though he checked all the cables and cords. What do yo
ExtremeBDS [4]
Im not for sure but it might be B or C
4 0
2 years ago
Read 2 more answers
How can templates be made available to other users?
Daniel [21]

Answer:

b

Explanation:

4 0
3 years ago
Dashed lines that display on your slide when you are moving an object and that assist you with alignment are referred to as:
Umnica [9.8K]
Smart guides is the answer.
7 0
3 years ago
Read 2 more answers
What is the real meaning of hack and crack?
vovangra [49]
Hack means hack computer and crack means I guess your behind
7 0
3 years ago
Im Gonna Give Brainly a Second Chance<br><br> Everybody deserves a second chance
Nady [450]

Answer:

ok I know it's not for me but for who?

Explanation:

Just asking. And yes everyone deserves a second chance. Even liars?

please don't take my question wrongly have an above average day!

7 0
3 years ago
Read 2 more answers
Other questions:
  • In your own words, describe the structure and function of both the stack and queue data structure and discuss how they are diffe
    6·1 answer
  • The combination of two or more technologies or data feeds into a single, integrated tool is referred to as a _____.
    7·1 answer
  • "how do we store information in long term memory?"
    12·1 answer
  • What happens if you move unencrypted files into an encrypted folder?
    5·1 answer
  • How do you measure objects and re-size them in tinkercad? I need it in steps.
    7·1 answer
  • Implement the function:
    6·1 answer
  • Among the second generation home console companies,which managed to come out on top
    10·1 answer
  • How did the military in the early 1900s move resources?
    7·1 answer
  • A video game controller contains the buttons: A, B, X, Y. When the player presses A their character Jumps. When the player press
    15·1 answer
  • Why does a crane need to rotate/swivel​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!