An essential Julian Day Program
watch basic java videos herewww.youtube.com/user/trushntej
The term “Julian day” is used loosely to mean the day of the year, meaning a number from 1 to 365 or 366 (leap years). January 1 is 1 , January 2 is 2, December 31 is 365 (or 366 in leap years).
watch basic java videos here
www.youtube.com/user/trushntej
Write a program to accept a date in dd mm yyyy format, and print the Julian day.
import java.io.*;
public class JulianNumber
{
int d,m,y;
int n;
void input()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter the date in dd mm yyyy format");
d=Integer.parseInt(br.readLine());
m=Integer.parseInt(br.readLine());
y=Integer.parseInt(br.readLine());
if(m<=12&&d<=31)
{
compute();
}
else
System.out.println("Invalid date");
}
void compute()
{
int arr[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(y%4==0)
arr[1]=29;
for(int i=0;i<m-1;i++)
{
n+=arr[i];
}
n=n+d;
System.out.println("The Julian day is: "+n);
}
public static void main()throws IOException
{
JulianNumber obj=new JulianNumber();
obj.input();
}
}Output:
Enter the date in dd mm yyyy format
01
02
2020
The Julian day is :32
Take a look at some other java programs:
A Simple program: Sum of Boundary elements of a Matrix
Related Posts
Continue learning with these related articles

User-Defined Methods in Java for ICSE Class 10: Parameters, Return and Overloading
ICSE Class 10 Computer Applications notes on user-defined methods: method prototype and signature, formal and actual parameters, return types, call by value vs call by reference, pure and impure methods, static methods and method overloading, with programs.

ISC Practical 2027: Image Editor – Brighten an Image and Find Bright Spots (2-D Array) – Java Program
Fully solved ISC Computer Science Practical 2027 2-D array question: brighten a grayscale image (capping values at 255) and find the bright spots, pixels larger than all four neighbours. Includes a missing bright spot in CISCE’s sample output.

ISC Practical 2027: College Enrolment Code Validator and Stream Report – Algorithm and Java Program
Fully solved ISC Computer Science Practical 2027 question: validate college enrolment codes made of a stream, year and serial number, give the exact reason for each rejection, auto-correct lowercase streams and prepare a stream-wise report.