Date Program in Java
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
Other Videos By Robin Sir
2023-11-27 | Computational Complexity | ISC Class 12 Computer Science |
2023-11-23 | KMap Solution (ISC 2023 Paper 1) |
2023-11-16 | Dudeney Number Java Program (ISC Theory Paper 2023) |
2023-11-15 | KMap Solution (ISC Sample Paper 2024) |
2023-11-14 | Reverse a Number using Recursion in Java |
2023-11-13 | Lecture 8 String Manipulation in Python |
2023-11-08 | Binary Tree (Recursive Data Structure) |
2023-11-06 | Vowels & Consonants Bar Graph Program in Java |
2023-11-04 | Keyword Cipher Program in Java |
2023-11-02 | Lecture 7 Loops in Python |
2023-10-31 | Date Program in Java |
2023-10-28 | Lucky Numbers in Java |
2023-10-26 | Rotate Matrix 270 Degrees Anti-clockwise in Java |
2023-10-24 | The elif Keyword in Python |
2023-10-24 | Vampire Number in Java |
2023-10-18 | Doubly Markov Matrix in Java |
2023-10-16 | Lecture 5 The If Statement in Python |
2023-10-14 | Snowball String in Java |
2023-10-12 | Hamming Number in Java |
2023-10-10 | Lecture 4 ID Function in Python |
2023-10-01 | Lecture 3 Input in Python |