Determining how to leap year and not with java

p4rtzone friend who is always in the blessed gods, the opportunity this time we will try

how to make the program determine the leap year and not a leap year, and for

selection we try using if else, nah but before we love the source code we must know what it is leap year, leap year is the year number is divisible by 4, well now easy to know tow, let us try to make it ok.

but first we define function

if (a % 4 !=0)
{
System.out.print(“Bukan Tahun Kabisat\n”);
}
else if ((a % 100==0)&&(a % 400 !=0))
{
System.out.print(“tahun Bukan kabisat\n”);
}
else
{
System.out.print(“tahun kabisat\n”);
}


after that let's try the same same kit to implement the source code below, but do not forget there are still some who Hars in repair, so that we can learn from his mistakes okok
ok friend ni complete source code,

import java.util.Scanner;
public class TahunKabisat
{
public static void main( String[] args )
{
Awal X = new Awal();
X.masukan();
X.proses();

}
}
public class Awal
{
public final void masukan()
{
System.out.print(“Masukkan bilangan input : “);
Scanner input = new Scanner(System.in);
System.out.print(“Masukkan nilai a : “);
a = input.nextInt();
}
public final void proses()
{
if (a % 4 !=0)
{
System.out.print(“Bukan Tahun Kabisat\n”);
}
else if ((a % 100==0)&&(a % 400 !=0))
{
System.out.print(“tahun Bukan kabisat\n”);
}
else
{
System.out.print(“tahun kabisat\n”);
}

}

private int a;

}


0 comments:

Twitter Delicious Facebook Digg Favorites More