Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2935
| From | Knute Johnson <eternal@knutejohnson.com> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Help |
| Date | 2014-03-25 08:55 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <lgs8tq$v63$1@dont-email.me> (permalink) |
| References | <803c64a0-66c7-48b8-b9d2-de5520db66a3@googlegroups.com> <0c85aacc-55fc-4abf-9560-eb6bb78c9c17@googlegroups.com> |
On 3/25/2014 06:54, Isaac Chan wrote:
> I have fixed most of the problems.This is supposed to change ++ into + and -- into + and +- into -.Though it compile successfully ,it refuse to function.
> I am new to this.Can u guys help me?
>
>
> import java.util.Scanner;
> class IngeniusXD
> {Scanner scn = new Scanner(System.in);
> private static String Simplify(String cal ,char st ,char nd ,char rep)
> {for (int i = 0;i < cal.length() - 100; i++)
> {if ((cal.charAt(i) == st) || (cal.charAt(i + 1) == nd))
> {cal = cal.substring(0 ,i - 1) + rep + cal.substring(i + 2);}
> else if ((cal.charAt(i) == nd) || (cal.charAt(i + 1) == st))
> {cal = cal.substring(0 ,i - 1) + rep + cal.substring(i + 2);}}
> return cal;}
> public static String Simplify_General(String cal)
> {cal = Simplify(cal ,'+' ,'-' ,'-');
> cal = Simplify(cal ,'-' ,'-' ,'+');
> cal = Simplify(cal ,'+' ,'+' ,'+');
> return cal;}
> public static void Simplify_Test()
> {System.out.println("Simplify_Test:Input mathematical sentence");
> Scanner scn = new Scanner(System.in);
> String cal;
> cal = scn.nextLine();
> cal = Simplify_General(cal);
> System.out.println("Simplify_Test:Output=" + cal);}
> public static void main(String[] args)
> {Simplify_Test();}}
>
It compiles, what is it supposed to do? What input are we to give it?
--
Knute Johnson
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Help Isaac Chan <isaacchanszelong@gmail.com> - 2014-03-24 03:32 -0700
Re: Help Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-03-24 08:36 -0400
Re: Help Joerg Meier <joergmmeier@arcor.de> - 2014-03-24 14:00 +0100
Re: Help Roedy Green <see_website@mindprod.com.invalid> - 2014-03-25 08:16 -0700
Re: Help Roedy Green <see_website@mindprod.com.invalid> - 2014-03-26 17:50 -0700
Re: Help Isaac Chan <isaacchanszelong@gmail.com> - 2014-03-25 06:34 -0700
Re: Help Isaac Chan <isaacchanszelong@gmail.com> - 2014-03-25 06:54 -0700
Re: Help Roedy Green <see_website@mindprod.com.invalid> - 2014-03-25 08:17 -0700
Re: Help Knute Johnson <eternal@knutejohnson.com> - 2014-03-25 08:55 -0700
Re: Help Lew <lewbloch@gmail.com> - 2014-03-25 15:12 -0700
csiph-web