This site requires JavaScript, please enable it in your browser!
Greenfoot back
hassan08
hassan08 wrote ...

2019/5/15

HELP ME. I will appreciate it very much

hassan08 hassan08

2019/5/15

#
import greenfoot. *; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class questions here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class asks extends Actor
{
    /**
     * Act - do whatever the questions wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        // Add your action code here.
        int a = Greenfoot.getRandomNumber(10);
        int b = Greenfoot.getRandomNumber(10);
        int result = a + b;
        int answer = Integer.parseInt(Greenfoot.ask("How much is " + a + " + " + b + "?"));
        
        if (result == answer)
        {
            Message messagebox = new Message("Well Done You Go to The next LEVEl!!!!");

        }
        else
        {
            Message messagebox = new Message("You Failed!! Try Again!");
        }
    }    
}
me wrote...
what is wring with this comes up that it cant find symbol- method ask(java.lang.string)
You need to login to post a reply.