Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Ad icon
ZTE MF283U 4G Unlocked Router (Used)
ayanthamaxi
Updated:
Sunday at 8:26 PM
ලංකාවේ හොඳම උපකාරක පන්ති සහ ගුරුවරුන් එකම තැනකින් - TopTuition.lk
dulithapathum
Updated:
Saturday at 8:07 AM
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Jul 15, 2026
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Jul 15, 2026
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Jul 15, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
Computers & Internet
Software Development
javascript waddo waren
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Chathuranga1" data-source="post: 19412141" data-attributes="member: 75417"><p>[CODE]/**</p><p> * To change this template, choose Tools | Templates and open the template in</p><p> * the editor.</p><p> */</p><p>package age;</p><p></p><p>import java.util.Scanner;</p><p></p><p>/**</p><p> *</p><p> * @author ACHCHUTHAN</p><p> */</p><p>public class NIC_Details {</p><p></p><p> String id;</p><p> int month[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};</p><p></p><p> public NIC_Details() {</p><p> Scanner input = new Scanner(System.in);</p><p> System.out.println("Enter Your NIC Number \nLike : 000000000V");</p><p> id = input.next();</p><p> }</p><p></p><p> public int getYear() {</p><p> return (1900 + Integer.parseInt(id.substring(0, 2)));</p><p> }</p><p></p><p> public int getDays() {</p><p> int d = Integer.parseInt(id.substring(2, 5));</p><p> if (d > 500) {</p><p> return (d - 500);</p><p> } else {</p><p> return d;</p><p> }</p><p> }</p><p></p><p> public void setMonth() {</p><p> int mo = 0, da = 0;</p><p> int days = getDays();</p><p></p><p> for (int i = 0; i < month.length; i++) {</p><p> if (days < month[i]) {</p><p> mo = i + 1;</p><p> da = days;</p><p> break;</p><p> } else {</p><p> days = days - month[i];</p><p> }</p><p> }</p><p> System.out.println("Month : " + mo + "\nDate : " + da);</p><p></p><p> }</p><p></p><p> public String getSex() {</p><p> String M = "Male", F = "Female";</p><p> int d = Integer.parseInt(id.substring(2, 5));</p><p> if (d > 500) {</p><p> return F;</p><p> } else {</p><p> return M;</p><p> }</p><p> }</p><p></p><p> public static void main(String[] args) {</p><p> NIC_Details N = new NIC_Details();</p><p> System.out.println("Your Deatials of Date of Birth from NIC Number");</p><p> System.out.println("Year : " + N.getYear());</p><p> N.setMonth();</p><p> System.out.println("Sex : " + N.getSex());</p><p> }</p><p>}</p><p></p><p>Output of this program :</p><p></p><p>run:</p><p>Enter Your NIC Number </p><p>Like : 000000000V</p><p>900733550v</p><p>Your Deatials of Date of Birth from NIC Number</p><p>Year : 1990</p><p>Month : 3</p><p>Date : 13</p><p>Sex : Male[/CODE]</p><p></p><p><span style="font-size: 15px">මේකම JS වලට හරවපන් </span></p></blockquote><p></p>
[QUOTE="Chathuranga1, post: 19412141, member: 75417"] [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[/CODE] [SIZE="4"]මේකම JS වලට හරවපන් [/SIZE] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom