in the Counter when compile it, this error comes up "incompatible types - found java.lang.Object but expected Money" because of int value in line 33 "get()"
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
/**
* Chocolate Dispenser Machine
*
*/
public class Counter extends Actor
{
private int credit;
private boolean moneyFound = false;
/**
* Act - do whatever the Counter wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
coinFound();
noteFound();
getCredit();
update();
}
/**
* Counting all Coins in Money class, which are inserted into the Coin Insertion.
*/
public void coinFound()
{
if (!moneyFound && !getWorld().getObjectsAt(517, 314, Money.class).isEmpty())
{
moneyFound = true;
Money money = getWorld().getObjectsAt(517, 314, Money.class).get(0);
credit += money.getValue();
}
if (moneyFound && getWorld().getObjectsAt(517, 314, Money.class).isEmpty())
{
moneyFound = false;
}
}
/**
* Counting all Notes in Money class, which are inserted into the Note Insertion.
*/
public void noteFound()
{
if (!moneyFound && !getWorld().getObjectsAt(517, 314, Money.class).isEmpty())
{
moneyFound = true;
Money money = getWorld().getObjectsAt(517, 314, Money.class).get(0);
credit += money.getValue();
}
if (moneyFound && getWorld().getObjectsAt(517, 314, Money.class).isEmpty())
{
moneyFound = false;
}
}
/**
*
*/
public int getCredit()
{
return credit;
}
/**
*
*/
public void update()
{
img.drawString("Credit: " + credit, 10, 60);
setImage(img);
}
}


