/**
* To change this template, choose Tools | Templates and open the template in
* the editor.
*/
package age;
import java.util.Scanner;
/**
*
* @author ACHCHUTHAN
*/
public class NIC_Details {
String id;
int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
public NIC_Details() {
Scanner input = new Scanner(System.in);
System.out.println("Enter Your NIC Number \nLike : 000000000V");
id = input.next();
}
public int getYear() {
return (1900 + Integer.parseInt(id.substring(0, 2)));
}
public int getDays() {
int d = Integer.parseInt(id.substring(2, 5));
if (d > 500) {
return (d - 500);
} else {
return d;
}
}
public void setMonth() {
int mo = 0, da = 0;
int days = getDays();
for (int i = 0; i < month.length; i++) {
if (days < month[i]) {
mo = i + 1;
da = days;
break;
} else {
days = days - month[i];
}
}
System.out.println("Month : " + mo + "\nDate : " + da);
}
public String getSex() {
String M = "Male", F = "Female";
int d = Integer.parseInt(id.substring(2, 5));
if (d > 500) {
return F;
} else {
return M;
}
}
public static void main(String[] args) {
NIC_Details N = new NIC_Details();
System.out.println("Your Deatials of Date of Birth from NIC Number");
System.out.println("Year : " + N.getYear());
N.setMonth();
System.out.println("Sex : " + N.getSex());
}
}
Output of this program :
run:
Enter Your NIC Number
Like : 000000000V
900733550v
Your Deatials of Date of Birth from NIC Number
Year : 1990
Month : 3
Date : 13
Sex : Male
මේකම JS වලට හරවපන්Code:/** * To change this template, choose Tools | Templates and open the template in * the editor. */ package age; import java.util.Scanner; /** * * @author ACHCHUTHAN */ public class NIC_Details { String id; int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; public NIC_Details() { Scanner input = new Scanner(System.in); System.out.println("Enter Your NIC Number \nLike : 000000000V"); id = input.next(); } public int getYear() { return (1900 + Integer.parseInt(id.substring(0, 2))); } public int getDays() { int d = Integer.parseInt(id.substring(2, 5)); if (d > 500) { return (d - 500); } else { return d; } } public void setMonth() { int mo = 0, da = 0; int days = getDays(); for (int i = 0; i < month.length; i++) { if (days < month[i]) { mo = i + 1; da = days; break; } else { days = days - month[i]; } } System.out.println("Month : " + mo + "\nDate : " + da); } public String getSex() { String M = "Male", F = "Female"; int d = Integer.parseInt(id.substring(2, 5)); if (d > 500) { return F; } else { return M; } } public static void main(String[] args) { NIC_Details N = new NIC_Details(); System.out.println("Your Deatials of Date of Birth from NIC Number"); System.out.println("Year : " + N.getYear()); N.setMonth(); System.out.println("Sex : " + N.getSex()); } } Output of this program : run: Enter Your NIC Number Like : 000000000V 900733550v Your Deatials of Date of Birth from NIC Number Year : 1990 Month : 3 Date : 13 Sex : Male

meka kohomada bn js valata haravannefunction getSex(nicValue)
{
var d=parseInt(nicValue.substring(2,5));
if (d>500) {
return "Female";
}else{
return "Male";
}
}
machan dan aluth vidiyata id card eka hadanneth mehemada bn??මේකම JS වලට හරවපන්Code:/** * To change this template, choose Tools | Templates and open the template in * the editor. */ package age; import java.util.Scanner; /** * * @author ACHCHUTHAN */ public class NIC_Details { String id; int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; public NIC_Details() { Scanner input = new Scanner(System.in); System.out.println("Enter Your NIC Number \nLike : 000000000V"); id = input.next(); } public int getYear() { return (1900 + Integer.parseInt(id.substring(0, 2))); } public int getDays() { int d = Integer.parseInt(id.substring(2, 5)); if (d > 500) { return (d - 500); } else { return d; } } public void setMonth() { int mo = 0, da = 0; int days = getDays(); for (int i = 0; i < month.length; i++) { if (days < month[i]) { mo = i + 1; da = days; break; } else { days = days - month[i]; } } System.out.println("Month : " + mo + "\nDate : " + da); } public String getSex() { String M = "Male", F = "Female"; int d = Integer.parseInt(id.substring(2, 5)); if (d > 500) { return F; } else { return M; } } public static void main(String[] args) { NIC_Details N = new NIC_Details(); System.out.println("Your Deatials of Date of Birth from NIC Number"); System.out.println("Year : " + N.getYear()); N.setMonth(); System.out.println("Sex : " + N.getSex()); } } Output of this program : run: Enter Your NIC Number Like : 000000000V 900733550v Your Deatials of Date of Birth from NIC Number Year : 1990 Month : 3 Date : 13 Sex : Male
podi wadak ne ban
Code:function getSex(nicValue) { var d=parseInt(nicValue.substring(2,5)); if (d>500) { return "Female"; }else{ return "Male"; } }

meka java neda bnmeka kohomada bn js valata haravanne

machan dan aluth vidiyata id card eka hadanneth mehemada bn??
parana vidiyata id numbers duplicate eva thibba kathavak thibba neda bn??

ehema siddiyak thibba bn.mata mokedida ahu une kiyala mathaka na bnඑහෙම සින් එකක් නම් මමත් අහල තිබ්බේ නෑ මචෝ![]()
ehema siddiyak thibba bn.mata mokedida ahu une kiyala mathaka na bn
dan id vala code eka venas karalalu thiyenne
