Date Program in Java

Channel:
Subscribers:
1,540
Published on ● Video Link: https://www.youtube.com/watch?v=x9XGbuZdOxE



Duration: 20:26
343 views
10


Date Program in Java

Write a program in Java to accept day number (between 1 and 366) and year (yyyy) from the user and display the corresponding date. Also accept ‘N’ from the user where (1 ≤ N ≤ 100) to compute and display the future date ‘N’ days after the given date. Display an error message if the value of the day number or ‘N’ are not within the limit. Day number is calculated taking 1st January of the given year as 1.

Example 1
INPUT:
DAY NUMBER: 50
YEAR: 2023
N = 25
OUTPUT:
ENTERED DATE: FEBRUARY 19, 2023
25 DAYS LATER: MARCH 16, 2023

Example 2
INPUT:
DAY NUMBER: 321
YEAR: 2023
N: 77
OUTPUT:
ENTERED DATE: NOVEMBER 17, 2023
77 DAYS LATER: FEBRUARY 2, 2024

Example 3
INPUT:
DAY NUMBER: 400
YEAR: 2023
N = 125
OUTPUT:
INCORRECT DAY NUMBER
INCORRECT VALUE OF ‘N’

#computerscience #isc #java #date #samplepaper







Tags:
robin sir
date program java
java
isc computer science
sample question paper
practical question paper
solved question paper
java program to generate date