jaaaaaaa jetzt hab ichs ;-)
merci !!!
nach langem tüfteln tritt jetzt aber das nächste problem auf!
wie gebe ich das array aus? mit systemout.println funktioniert es nicht....
bei "sowas" muss ich doch mit "return" ausgeben...oder?
ich versuchs dauernd, aber anscheinend kann ich kein array (mit einer for schleife) ausgeben...
wie gebe ich das aus?
bei meinem punkt display....?
public class Bsp22{
public static void main (String [] args){
int left, right, top, bottom, p;
char choice, e, v, h, u, q, z, c;
Paper paper = new Paper();
System.out.println("Papiergröße?");
p = SavitchIn.readLineInt();
System.out.println("Geben Sie die Größe des Rechtecks im Koordinatensystem an!");
System.out.println("Rechteck 1");
System.out.println("linke Seite hat den Wert: ");
left = SavitchIn.readLineInt();
System.out.println("rechte Seite hat den Wert: ");
right = SavitchIn.readLineInt();
System.out.println("obere Seite hat den Wert: ");
top = SavitchIn.readLineInt();
System.out.println("untere Seite hat den Wert: ");
bottom = SavitchIn.readLineInt();
paper.rectangle(left, right, top, bottom, p);
/*
System.out.println("Rechteck 2");
System.out.println("linke Seite hat den Wert: ");
left = SavitchIn.readLineInt();
System.out.println("rechte Seite hat den Wert: ");
right = SavitchIn.readLineInt();
System.out.println("obere Seite hat den Wert: ");
top = SavitchIn.readLineInt();
System.out.println("untere Seite hat den Wert: ");
bottom = SavitchIn.readLineInt();
paper.rectangle(left, right, top, bottom, p, 2);*/
do{
System.out.println("z(eigen) || q(uadrat?) || u(eberschneiden?) || (move)h(horzontal) || (move)v(ertikal || e(nde)");
choice = SavitchIn.readLineNonwhiteChar();
if (choice == 'z'){
System.out.println("Symbol?");
c = SavitchIn.readLineNonwhiteChar();
paper.display(c);
}
else if (choice =='q'){}
else if (choice =='u'){}
else if (choice =='h'){}
else if (choice =='v'){}
}while ( choice != 'e');
}
}
public class Paper{
private char [][] square;
private int p;
public void rectangle (int left, int right, int top, int bottom, int p){
char [][] square = new char [p][p];
for (int i=0; i<p; i++){ // belegung mit 0
for (int j=0; j<p; j++)
square[j] = '0';}
for( int j=left-1; j<right;j++){ //top
int i=top-1;
square [j] = '1';
}
for( int j=left-1; j<right;j++){ //bottom
int i=bottom-1;
square [j] = '1';}
for ( int i=top-1; i<bottom;i++){ //left
int j = left-1;
square [j] = '1';}
for (int i=top-1; i<bottom;i++){ // right
int j = right-1;
square [j] = '1';}
}
public void rectangle (int left, int right, int top, int bottom, int p, int n){
char [][] square = new char [p][p];
for (int i=0; i<p; i++){ // belegung mit 0
for (int j=0; j<p; j++)
square[j] = '0';}
for( int j=left-1; j<right;j++){ //top
int i=top-1;
square [j] = '1';
}
for( int j=left-1; j<right;j++){ //bottom
int i=bottom-1;
square [j] = '1';}
for ( int i=top-1; i<bottom;i++){ //left
int j = left-1;
square [j] = '1';}
for (int i=top-1; i<bottom;i++){ // right
int j = right-1;
square [j] = '1';}
}
public void display(char c)
{
}
}