The question:
Write a method that takes an ArrayList of Integer objects and returns an ArrayList of Character objects of the same size. The returned elements of the ArrayList are assigned a letter grade corresponding to the integer grade of the same index element of the ArrayList parameter( A if 90 or above,...,F if less than 60). Include code to test your method.
this is what I have so far and don't know what to do after this:
import java.util.ArrayList;
public class ReturningGrade
{
public static void main(String[] args)
{
ArrayList grade = new ArrayList();
System.out.println("Initial size of grade is: " +grade.size());
grade.add("A");
grade.add("B");
grade.add("C");
grade.add("D");
grade.add("F");
Object letterGrade[] = grade.toArray();
int letgrade = 0;
// sum the array
if(letgrade => 90)
System.out.println("Your letter grade is: " +grade.toArray());
}
}
Any help/comments will be greatly appreciated and will definitely help me better understand arraylists.

New Topic/Question
Reply



MultiQuote




|