Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the web to learn how to use the LocalDate Boolean methods isBefore(), isAfter(), and equals(). Use your knowledge to write a program that prompts

Use the web to learn how to use the LocalDate Boolean methods isBefore(), isAfter(), and equals(). Use your knowledge to write a program that prompts a user for a month, day, and year, and then displays a message specifying whether the entered day is in the past, is today(the current date), or is in the future.

Given code:

import java.util.*;

import java.time.*;

public class PastPresentFuture2

{

public static void main (String args[])

{

LocalDate today = LocalDate.now();

LocalDate enteredDate;

int mo, da, yr;

int todayMo, todayDa, todayYr;

Scanner input = new Scanner(System.in);

System.out.print("Enter a month >> ");

mo = input.nextInt();

System.out.print("Enter a day >> ");

da = input.nextInt();

System.out.print("Enter a year (four digits) >> ");

yr = input.nextInt();

// Write your code here

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

f. Did they change their names? For what reasons?

Answered: 1 week ago