Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2928
| Newsgroups | comp.lang.java.help |
|---|---|
| Date | 2014-03-24 03:32 -0700 |
| Message-ID | <803c64a0-66c7-48b8-b9d2-de5520db66a3@googlegroups.com> (permalink) |
| Subject | Help |
| From | Isaac Chan <isaacchanszelong@gmail.com> |
Anyone knowing what is happening below?
It keeps bumping out the <identifier> expected error.
import java.util.Scanner;
class IngeniusXD
{Scanner scn = new Scanner(System.in);
private String Simplify(String cal ,char st ,char nd ,char new)
{for (int i = 0;i < cal.length() -1; i++)
{if ((cal.charAt(i) == st) || (cal.charAt(i + 1) == nd))
{cal = cal.substring(0 ,i - 1) + new + cal.substring(i + 2);}
else if ((cal.charAt(i) == nd) || (cal.charAt(i + 1) == st))
{cal = cal.substring(0 ,i - 1) + new + cal.substring(i + 2);}}
return cal;}
public String Simplify_General(String cal)
{cal = Simplify(cal ,'+' ,'-' ,'-');
cal = Simplify(cal ,'-' ,'-' ,'+');
cal = Simplify(cal ,'+' ,'+' .'+');
return cal;}
public void Simplify_Test()
{System.out.println("Simplify_Test:Input mathematical sentence.");
cal = scn.next();
cal = Simplify_General(cal);
System.out.println("Simplify_Test:Output=");}
public static void main(String[] args)
{SimplifyTest();}}
Back to comp.lang.java.help | Previous | Next — 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