Main.java
/* MAC0122 - Princípios de Desenvolvimento de Algoritmos *
* Prof. Alair *
* *
* Primeiro Exercício-Programa: Um Compilador de Fractais *
* *
* Nome - número USP */
class Main {
public static void main(String[] args) {
int n; /* nível de recursão da curva fractal */
double alfa; /* valor de alfa */
double beta; /* valor de beta */
double u; /* comprimento u */
double x, y; /* coordenadas x e y do estado inicial */
String R;/* string correspondente à recorrência */
String A; /* string correspondente ao axioma */
if(args.length != 8) {
/* impressão de mensagem de erro */
System.err.println("Uso: <n> <q1> <R> <A> <u> <x> <y> <q2>\n");
System.err.println(" <n> e o nivel de recursao da curva fractal;");
System.err.println(" <q1> e o quociente pi/beta;");
System.err.println(" <R> e o string R correspondente a recorrencia;");
System.err.println(" <A> e o string A correspondente ao axioma;");
System.err.println(" <u> e o comprimento u;");
System.err.println(" <x> e a coordenada x do estado inicial;");
System.err.println(" <y> e a coordenada y do estado inicial;");
System.err.println(" <q2> e o quociente pi/alfa, onde alfa e a direcao do estado inicial.");
System.err.println("");
System.exit(-1);
}
/* interpretação dos parâmetros */
try {
n = Integer.parseInt(args[0]);
}
catch(Exception e) {
System.err.println("Nível de recursão inválido.");
System.exit(-1);
}
try {
beta = Double.parseDouble(args[1]);
}
catch(Exception e) {
System.err.println("Valor de beta inválido.");
System.exit(-1);
}
R = new String(args[2]);
A = new String(args[3]);
try {
u = Double.parseDouble(args[4]);
}
catch(Exception e) {
System.err.println("Valor de u inválido.");
System.exit(-1);
}
try {
x = Double.parseDouble(args[5]);
}
catch(Exception e) {
System.err.println("Valor de x inválido.");
System.exit(-1);
}
try {
y = Double.parseDouble(args[6]);
}
catch(Exception e) {
System.err.println("Valor de y inválido.");
System.exit(-1);
}
try {
alfa = Double.parseDouble(args[7]);
}
catch(Exception e) {
System.err.println("Valor de alfa inválido.");
System.exit(-1);
}
/* seu programa */
/*System.out.println("Gerador de fractais"); */
}
}
Generated by GNU enscript 1.6.4.