Sunday, October 25, 2009
JAVA oo JAVA..
Assalamualaikum WBT.
Huhu.. Java language. I love it! But it is so complicated..
I have two examples here..
public class milesTokm {
public static void main(String[] args) {
double Km = new(miles);
int miles = i;
System.out.println("Miles"/t/t/t/t/t"Kilometres\n");
System.out.println(miles+"/t/t/t/t/t"+Km+"\n");
}
public static int i{
for (i=1; i <=10; ++i);
}
public static double new(int MILE){
double result:
result= MILE*1.609;
return result;
}
}
**********************************************************************************
I tried to build this project by JCreater software but so many errors.. so sad.
I cannot run this coding for my tutorial answer. Huhu..
But, I have a good news for the other question.. Hoho. Alhamdulillah!
Thanx nik coz gave me the answer..
import java.util.Scanner;
public class reverseInteger{
public static void main(String[]args){
int num=0;
reverse(num);
}
public static void reverse(int num) {
Scanner input = new Scanner(System.in);
System.out.println("please enter 5 integer only");
num = input.nextInt();
int remainder,remainder1,remainder2,remainder3,remainder4,remainder5;
int reNum1,reNum2,reNum3,reNum4,reNum5;
remainder = num%10;
reNum1 = num/10;
remainder1 = reNum1%10;
reNum2 = reNum1/10;
remainder2 = reNum2%10;
reNum3 = reNum2/10;
remainder3 = reNum3%10;
reNum4 = reNum3/10;
remainder4 = reNum4%10;
reNum5 = reNum4/10;
remainder5 = reNum5%10;
System.out.println("reverse number is" +remainder+remainder1+remainder2+remainder3+remainder4);
}
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I can build and run this coding and the output is..
please enter 5 integer only
45623
reverse number is32654
Process completed.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
HUhu.. Thanx Ya Allah! I'm very happy now..
.:. ~Tinta Nur aziemah~ .:.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment