How to program this in java? Please help

How to program this in java?please explain steps, it has to come out like this:exampleinput: 3b1w3boutput:BBBWBBB
[155 byte] By [moopa] at [2007-11-26 16:20:02]
# 1
Do your own homework.
warnerjaa at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 2
Is there even a question here? After browsing through these forums for awhile, I've seen many homework questions, but this is .... I'm scared.
Djaunla at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 3

import junit.framework.TestCase;

public class TestHomework extends TestCase {

public void testGIGO() {

String input = "3b1w3b";

String expectedOutput = "BBBWBBB";

HomeworkWorker worker = new HomeworkWorker();

assertEquals("you are not clever enough to do this yourself", expectedOutput, worker.doHomework(input));

}

class HomeworkWorker {

public String doHomework(String input) {

return "BBBWBBB";

}

}

}

Le Bar Verte - hooray

enjoy

georgemca at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 4

No one here will do something like that for you!! I will not tell you that it is easy because maybe you just only started programming. However I will give you some sugestions!!

1. Pencil and Paper are your friends! Try writing on a peace of paper what you want to do in normal english. A paragraph will be more then enough, then try to change that in a set of steps!

2. You will realize that you need some classes already in Java. Did your tutor already tell you about them? try searching in your notes!

3. Try something out first. Come here, show us what you tried out, and someone will help you!

Remeber that for some people here that problem can be solved in a minute max! they do not tell you the answer because they want you to learn something!

Regards,

Sim085

sim085a at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 5

Are you guys abusing the newbies again? Didn't UJ tell you that's not allowed in here? Hmm?

@OP: Here you go, hand this in to your teacher:

public class Test {

static java.io.PrintStream o = java.lang.System.out;

public static void main(String[] args) {

String s = "3b1w3b";

char[] cs = s.toLowerCase().toCharArray();

for(int i=0x0, j=0x0; i < cs.length-0x1; i+=0x2, j=0x0) {

while(j++ < (int)(cs[i]-0x30)){ o.print((char)(cs[i+0x1]-0x20));}

}

}

}

prometheuzza at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 6

> Are you guys abusing the newbies again? Didn't UJ

> tell you that's not allowed in here? Hmm?

> @OP: Here you go, hand this in to your teacher:

> public class Test {

> static java.io.PrintStream o =

> java.lang.System.out;

>public static void main(String[] args) {

>String s = "3b1w3b";

>char[] cs = s.toLowerCase().toCharArray();

> for(int i=0x0, j=0x0; i < cs.length-0x1; i+=0x2,

> j=0x0) {

> while(j++ < (int)(cs[i]-0x30)){

> o.print((char)(cs[i+0x1]-0x20));}

>}

> }

thanks prometheuzz for sharing your knowledge , this was a big help to me

moopa at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 7
> > ...>> thanks prometheuzz for sharing your knowledge , this> was a big help to meNo prob, just hand it in as is. I'm sure your teacher will be impressed!
prometheuzza at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 8
I think you deserve some sort of award for this.
DavidKNa at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 9

> public class Test {

> static java.io.PrintStream o =

> java.lang.System.out;

>public static void main(String[] args) {

>String s = "3b1w3b";

>char[] cs = s.toLowerCase().toCharArray();

> for(int i=0x0, j=0x0; i < cs.length-0x1; i+=0x2,

> j=0x0) {

> while(j++ < (int)(cs[i]-0x30)){

> o.print((char)(cs[i+0x1]-0x20));}

>}

> }

Oh great, so "10b" won't print as "bbbbbbbbbb"? While I'm at it, should

"30" print as "000" or generate an exception? and what about "321",

should there be 32 "1"s, 3 "2"s or what? I demand correct, non-ambiguous

specifications! Anything else is *bogus*! Wraaahhhhgggrrr!

sorry ... I'll have a drink and calm down now; promised ;-)

kind regards,

Jos (< easy going, easy now, easy)

JosAHa at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 10

import java.io.*;

public class Test {

static java.io.PrintStream o = java.lang.System.out;

public static void main(String[] args)throws Exception {

BufferedReader BR = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter plot for printing: ");

String s = BR.readLine();

char[] cs = s.toLowerCase().toCharArray();

for(int i=0, j=0; i < cs.length-0x1; i+=0x2, j=0)

{

while(j++ < (int)(cs-0x30))

{

o.print((char)(cs[i+0x1]-0x20));

}

}

}

}

I tried changeing it to this so I can enter my own string, but I want to change it some more so that it can enter multiple input separated by space, so that it can form a sort of picture line by line. I tried using tolkenizer but I get errors. I dont know how to use tolkenizer properly can anyone please TEACH. you dont have to tell how or give me the code if you dont want to. yes I know Im a noob and I dont know java as good as everyone here, If everyone thinks I don't deserve help then DON'T help, I'm just trying to learn programming

moopa at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 11
// See the code button? /*It is very useful.*/char c = array[i]; // so [i] won't be mistaken for italics...
BIJ001a at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 12

No no, never use keyboard input! All real guys use arguments!

Sorry, prometheuzz, I changed formatting...

public class Test

{

static java.io.PrintStream o = java.lang.System.out;

public static void main( String[] args )

{

for( int k = 0; k < args.length; k++, o.println("") )

{

char[] cs = args[k].toLowerCase().toCharArray();

for(int i=0x0, j=0x0; i < cs.length-0x1; i+=0x2, j=0x0)

{

while(j++<(int)(cs[i]-0x30)){o.print((char)(cs[i+0x1]-0x20));}

}

}

}

}

Michael.Nazarov@sun.coma at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 13
> No no, never use keyboard input! All real guys use> arguments!> Sorry, prometheuzz, I changed formatting...No worries, it is still as *ahem* readable as it was.; )
prometheuzza at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...
# 14

BTW this code accepts strings like "10a5b" but I'm not sure this is correct behavior.

importjava.util.regex.*;

public class lox { static

java.io.PrintStreamo=

java.lang.System.out;static

Pattern p =Pattern.compile(

"([1-9]+[0-9]*)([a-z])" ) ;

public static void main (

String[]args){for(int j=0;j

<args.length;j++,o.println(

"" ) ){Matcher m=p.matcher(

args[j]) ; while(m.find()){

int c = Integer.parseInt(m.

group(1));String s=m.group(

2).toUpperCase();for(int i=

0;i<c;i++)o . print(s);}}}}

>

Michael.Nazarov@sun.coma at 2007-7-8 22:43:34 > top of Java-index,Java Essentials,Java Programming...