can anyone tell me my mistake please?

/*This program will convert integer grades to letter grades and say how many A's, B's, C's, D's , F's do we have

Berrehouma,Yassine

1/31/2014

*/

public class DSlab3

{

private char LetterGrades;

private int IntegerGrades;

//default constructor

public DSlab3()

{

LetterGrades =' ';

IntegerGrades = 0;

}

//Accessor

public DSlab3 (char LG,int IG)

{

}

public int getIG()

{

return IG;

}

public char getLG()

{

return LG;

}

//Mutator

public void setIG( int newIG)

{

IG = newIG;

}

public void setLG( char newLG)

{

LG = newLG;

}

public class RandomGen

{

public RandomGen() {

System.out.println("Random Number ....");

}//end of constructor

public static void main(String[] args)

{

int i, j;

int[]ArrayRand = new int[20] ;

for(i=0;i< 20;i++){

j = (int)(Math.random() * 100);

ArrayRand[i]= j;

System.out.print("array in " + i);

System.out.println(" is " + ArrayRand[i]);

}// end of for

}//end main

}//RandomGen

public class GradeL2I

{

// Instance variables

char A,B,C,D,F;

}

public static char integerToLetterGrade()

{

int n,m,x,y,z;

Char[]Result = new Char[20] ;//another Tab to stock the grades in letter

for(int i = 0; i <20;i++){

//converting the integer grades to letter grades

if (ArrayRand[i] >= 90)

{ Result[i] = A; }

else if (ArrayRand[i] >= 80)

{ Result[i] = B; }

else if (ArrayRand[i] >= 70)

{ Result[i] = C; }

else if (ArrayRand[i] >= 60)

{ Result[i] = D; }

else

{ Result[i] = F; }

}//end for

for(int j = 0; j <20;j++){//a method to count the number of As

if (Result[j] == A)

{

n = n+1;

}

}

System.out.println("number of As is equal to " + n);

for(int j = 0; j <20;j++){//a method to count the number of Bs

if (Result[j] == B)

{

m = m+1;

}

}

for(int j = 0; j <20;j++){//a method to count the number of Cs

if (Result[j] == C)

{

x = x+1;

}

}

for(int j = 0; j <20;j++){//a method to count the number of Ds

if (Result[j] == D)

{

y = y+1;

}

}

for(int j = 0; j <20;j++){//a method to count the number of Fs

if (Result[j] == F)

{

z = z+1;

}

}

System.out.println("The number of A's is equal to, " + n);

System.out.print(" the number of B's is equal to, " + m);

System.out.print(" the number of C's is equal to, " + x);

System.out.print(" the number of C's is equal to " + y);

System.out.print(" and the number of C's is equal to " + z);

}

}

Re: can anyone tell me my mistake please?

So what is going wrong? Besides you using variable names that are totally unreadable.

Re: can anyone tell me my mistake please?

Quote:

Originally Posted by

**metallica** System.out.println("The number of A's is equal to, " + n);

System.out.print(" the number of B's is equal to, " + m);

System.out.print(" the number of C's is equal to, " + x);

System.out.print(" the number of C's is equal to " + y);

System.out.print(" and the number of C's is equal to " + z);

Should this make sense?

kind regards,

Jos

Re: can anyone tell me my mistake please?

I am assuming it doesn't compile. And due to misplaced braces, you have:

Code:

`public class GradeL2I`

{

// Instance variables

char A,B,C,D,F;

}

which is a very small useless class. But that is just the start of your problems. What are the values of A,B,C,D, and F?

Regards,

Jim