۱۳۸۷ مهر ۳, چهارشنبه

محاسبه سن خورشیدی Computing your solar age

این برنامه در گروه جاوا ی گروه کار بران لینوکس اصفهان نوشته شده:

import javax.swing.JOptionPane;
class Age13 {
public static void main (String args[]) {
int Ity, Itm ,Itd ,Iby ,Ibm ,Ibd, cd, cm, cy;
String Name, Ty ,Tm ,Td ,By ,Bm ,Bd;
// double Tdd, Bdd, DAge, YY, MM, DD, MYY, MMM, MDD;
Name = JOptionPane.showInputDialog("Enter your name");

Ty = JOptionPane.showInputDialog("Enter this year");

Tm = JOptionPane.showInputDialog("Enter this month");

Td = JOptionPane.showInputDialog("Enter today");

By = JOptionPane.showInputDialog("Enter your birth year");

Bm = JOptionPane.showInputDialog("Enter your birth month");

Bd = JOptionPane.showInputDialog("Enter your birth day");
Ity = Integer.parseInt(Ty);

Itm = Integer.parseInt(Tm);

Itd = Integer.parseInt(Td);

Iby = Integer.parseInt(By);

Ibm = Integer.parseInt(Bm);

Ibd = Integer.parseInt(Bd);

cd= Itd - Ibd;

if ( cd <0 cd =" cd" itm =" Itm"> 6 && Itm != 12 ){
cd = cd + 30 ;
Itm = Itm - 1 ;
}
else if (cd<0 itm ="=" cd =" cd" itm ="=" cd =" cd" cm =" Itm" cm =" cm" ity =" Ity">12 && cm == 12)
{
cm = cm -12;
Ity = Ity +1;
}
cy = Ity - Iby;
JOptionPane.showMessageDialog( null,
"Your solar years are : " + cy +
"\n Your solar months are : " + cm +
// "\n Your solar days are : " + cd +
"\n Your solar days are : " + cd ,

"Hello " + Name,
JOptionPane.INFORMATION_MESSAGE);

System.exit(0);
}
}

This program created by Isfahan JAVA Group


0

هیچ نظری موجود نیست: