|
-
December 29th, 2011, 02:28 PM
#16
Re: Java Challenge
try this one.......
public class Problemconverter {
public static void convert(String s){
int len = s.length();
String next;
int count = 1;
if (len == 0)
return ;
else if(len == 1)
System.out.println(count+""+s.charAt(0));
else{
for(int i=0; i<len; i++){
if(s.charAt(i) == s.charAt(i+1)){
count++;
}
else break;
}
System.out.print(count+""+s.charAt(0));
next = s.substring(count);
convert(next);
}
}
public static void main(String[] args) {
convert("10444221");
}
}
-
December 30th, 2011, 12:13 PM
#17
Re: Java Challenge
Why are you guys so keen to do someone else's homework for them?
It doesn't help the OP at all because he/she won't learn anything from this assignment and so almost certainly won't be able to do the up coming assignments.
By all means provide guidance but please stop providing the code.
-
December 30th, 2011, 01:39 PM
#18
Re: Java Challenge
@keang.......
got it......man.......
will provide only guidance here after.......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|