I'm writing a program that allows the user to convert a line of java into pseudocode, so far, I've got the following:
import element.*;
publicclass a {
publicstaticvoid main(String[] args) {
ConsoleWindow c = new ConsoleWindow(); // opens console window
String inputLine, outputLine;
c.out.println("Enter a line");
inputLine = c.input.readString();
c.out.println("You have entered: "+ inputLine);
if (inputLine.endsWith(";"));
{outputLine="Is a java line";
c.out.println(inputLine + " is a valid line of java");}
if (inputLine.startsWith("int")) //if the input is an int expression
{outputLine="This is an integer datatype";
c.out.println("This is an integer datatype");} //this will come out
if (inputLine.startsWith("double")) //double
{outputLine="This is a double number datatype";
c.out.println("This is a double number datatype");}
if (inputLine.startsWith("long")) //long
{outputLine="This is a long integer datatype";
c.out.println("This is a long integer datatype");}
if (inputLine.startsWith("short")) //short
{outputLine="This is a short integer datatype";
c.out.println("This is a short integer datatype");}
if (inputLine.startsWith("char")) //char
{outputLine="This is an alphabetical character datatype";
c.out.println("This is an alphabetical character datatype");}
public ArithmeticException ("+", "-", "/", "*")
}
}
Somebody suggested me to use strings as well, but I don't quite understand how to get around to using it.
Checkout posting by Elise: HELP - converting characters,
I've given a suggestion on how to go about it. Just a Q: you have imported a package called element, if you are at the level where you are writing your own packages, this should be a trivial algorigthm for you, shouldn't it? Or am I misunderstanding the problem?
It looks to me, as though he hasn't written the package element himself, but rather uses it to take care of basic i/o functionality. e.g. the 'ConsoleWindow' object may be a class from within the element package.