I'm having trouble understanding why my code won't compile. I'm trying to create letters of the alphabet 1 row at a time. I'm using an array to story the images for the letters but when I try to call the array to create the objects with the desired image an error message ensues stating that "constructor Letter in class Letter cannot be applied to given types..." Clearly I'm missing something so I'm hoping someone can help me out. My TA tried helping me, but his accent can be tough to understand and he ended up just confusing me haha. Any help would be awesome. I'll post my code below:
this is the code for the LearningGame class:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class LearningGame here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class LearningGame extends World
{
private Letter recorder;
private String lettersFirstRow = {"A.png", "B.png", "C.png", "D.png", "E.png", "F.png", "G.png"};
/**
* Constructor for objects of class LearningGame.
*
*/
public LearningGame()
{
super(600, 455, 1);
//Create a recorder object to be used by the other elements in the scenario.
Recorder recorder = new Recorder();
//Insert your code for creating the letters here.
addObject(new Message(recorder), 300, 403);
for (int i=0; i < 7; i++)
{
getWorld().addObject(new Letter(recorder, lettersFirstRow, lettersFirstRow.charAt(0)), 39 + i*77, 25);
}
for (int i = 0; i < 7; i++)
{
addObject(new Letter(recorder),39 + i*77, 102);
}
for (int i = 0; i < 7; i++)
{
addObject(new Letter(recorder), 39 + i*77, 174);
}
for (int i = 0; i < 5; i++)
{
addObject(new Letter(recorder), 39 + i*77,244);
}
}
}
and this is the code for the Letter class:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* The letters to display on the screen.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Letter extends Actor
{
private Recorder _recorder;
private String lettersFirstRow = {"A.png", "B.png", "C.png", "D.png", "E.png", "F.png", "G.png"};
public Letter(Recorder recorder) {
_recorder = recorder;
//setImage(lettersFirstRow, lettersFirstRow.charAt(0));
}
/**
* Act - do whatever the Letter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
}
}

