Hello, I'm trying to create a scenario with a customer who's going over costs and sales images. Each time he does, it adds or subtracts to a profit. I need to display this profit on the bottom of the screen, but it says I can't convert the existing integer into the text string. Here's the customer code. What do I do?? Please help me!
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Customer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Customer extends Actor
{
private int Profit= 0; //profit=sales-cost
private String salesSound = "chaching.wav"; //the string to hold the sales sound file
private String costSound = "trombone.wav"; // the string to hold the cost sound file
private String customerSound = "";
/**
* Act - do whatever the Customer wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(1);
if (Greenfoot.isKeyDown("up"))
{
setRotation (270);
}
if (Greenfoot.isKeyDown("left"))
{
setRotation (180);
}
if (Greenfoot.isKeyDown("right"))
{
setRotation (0);
}
if (Greenfoot.isKeyDown("down"))
{
setRotation (90);
}
turnAtEdge();
lookForSales();
lookForCost();
getWorld().showText ("Profit", 350,550);
getWorld().showText ("The latest transaction", 350, 575);
}
public void turnAtEdge()
{
if (isAtEdge())
{
turn (Greenfoot.getRandomNumber (37)-18);
}
}
public void lookForSales()
{
if(isTouching(Sales.class) )
{
removeTouching(Sales.class);
Greenfoot.playSound(salesSound);
Profit = Profit + (Greenfoot.getRandomNumber (100)+100);
}
}
public void lookForCost()
{
if(isTouching(Cost.class) )
{
removeTouching(Cost.class);
Greenfoot.playSound(costSound);
Profit = Profit - (Greenfoot.getRandomNumber (50) + 100);
}
}
public int getProfit()
{
return Profit;
}
}

