Jump to content


I Need Some Help


  • Please log in to reply
5 replies to this topic

#1 FransHunter

FransHunter

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 08 May 2012 - 08:39 PM

Hello,

I really need some help with my java project.
I need to create a windmill with moving blades and a cloud moving from the left side to the right side.
I already did the moving blades but when i try to make the windmill i fail with 13 errors.

I'll subit the code directly under here, maybe someone can say what i did wrong...
I hope you guys can, thanks in advance.

My code:

/**
 * @(#)JavaTest.java
 *
 * JavaTest Applet application
 *
 * @author
 * @version 1.00 2012/4/11
 */

								 import logotekenap.*;
public class JavaTest extends TekenApplet
{
	   double hoek;

	   public void initialiseer()
	   {	   maakAnimatieMogelijk();
	   }

	   public void tekenprogramma()
	   {		penUit();
	   			stap(100,100);
	   			penAan(150, 75, 0) ;


	   			rechts(hoek);
			 	vierkant(100);---

	   }

	   void vierkant(double z)
	   {	   vulAan("rood");
			   for(int i=0 ; i<4 ; i++)
			   {
			   	vooruit(150);links(90);
			   	vooruit(37.5);links(90);
			   	vooruit(150);rechts(90);
			   	vooruit(112.5);links(90);
			   	vooruit(37.5);links(90);
			   	vooruit(150);rechts(90);
			   	vooruit(112.5);links(90);
			   	vooruit(37.5);links(90);
			   	vooruit(150);rechts(90);
			   	vooruit(112.5);links(90);
			   	vooruit(37.5);links(90);
			   	vooruit(150);links(90);
			   	vooruit(37.5);
			   }
			   {

			   vulUit();

	   }

			public void animatie();
	   {	   while(animatieLopend())
			   {	   hoek = hoek + 0.1;
					   tekenOpnieuw();
			   }
	   }
	   public void tekenprogramma()
	   {		penUit();
	   			stap(100,100);
	   			penAan(255, 0, 0) ;

				molen(100);

		void molen
	   {	   vulAan("rood");
			   for(int i=0 ; i<4 ; i++)
			   {
			   	vooruit(100);links(90);
			   	vooruit(25);links(90);
			   	vooruit(250);rechts(90);
			   	vooruit(250);links(90);
			   	vooruit(250);links(90);
			   	vooruit(25);rechts(90);
			   	vooruit(100);links(90);
			   	vooruit(200);links(90);
							  }
			   {

			   vulUit();
			   }


#2 nyccanuck

nyccanuck

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 09 May 2012 - 01:55 AM

View PostFransHunter, on 08 May 2012 - 08:39 PM, said:

Hello,

I really need some help with my java project.
I need to create a windmill with moving blades and a cloud moving from the left side to the right side.
I already did the moving blades but when i try to make the windmill i fail with 13 errors.

I'll subit the code directly under here, maybe someone can say what i did wrong...
I hope you guys can, thanks in advance.

My code:

...



What are the errors????

Some obvious things that I can see are:
1. in your tekenprogramma method you have
vierkant(100);---
  What is the --- for?
2. you do not have all of your methods closed (missing } )

If you can add the errors then it would make it easier to help you...

#3 FransHunter

FransHunter

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 09 May 2012 - 08:26 AM

View Postnyccanuck, on 09 May 2012 - 01:55 AM, said:

What are the errors????

Some obvious things that I can see are:
1. in your tekenprogramma method you have
vierkant(100);---
  What is the --- for?
2. you do not have all of your methods closed (missing } )

If you can add the errors then it would make it easier to help you...

Here are my errors:

error: illegal start of expression Line 54
error: illegal start of expression Line 54
error: ';' expected Line 54
error: illegal start of expression Line 60
error: illegal start of expression Line 60
error: ';' expected Line 60
error: illegal start of expression Line 67
error: ';' expected Line 67
error: reached end of file while parsing Line 83

And here's the code again:

/**
* @(#)JavaTest.java
*
* JavaTest Applet application
*
* @author
* @version 1.00 2012/4/11
*/

                                 import logotekenap.*;
public class JavaTest extends TekenApplet
{
       double hoek;

       public void initialiseer()
       {       maakAnimatieMogelijk();
       }

       public void tekenprogramma()
       { penUit();
       stap(100,100);
       penAan(150, 75, 0);


           rechts(hoek);
             vierkant(100);

       }

       void vierkant(double z)
              vulAan("rood");
               for(int i=0 ; i<4 ; i++)
               {
               vooruit(150);links(90);
               vooruit(37.5);links(90);
               vooruit(150);rechts(90);
               vooruit(112.5);links(90);
               vooruit(37.5);links(90);
               vooruit(150);rechts(90);
               vooruit(112.5);links(90);
               vooruit(37.5);links(90);
               vooruit(150);rechts(90);
               vooruit(112.5);links(90);
               vooruit(37.5);links(90);
               vooruit(150);links(90);
               vooruit(37.5);
               }
               {

               vulUit();

          void windmill(double z)
             vulAan("rood");
               for(int i=0 ; i<4 ; i++)
               {
               links(180)
               vooruit(100);rechts(90);
               vooruit(50);links(90);
               vooruit(250);links(90);
               vooruit(200);links(90);
               vooruit(250);links(90);
               vooruit(50);rechts(90);
               vooruit(100);links(90);
               vooruit(100);links(90);
                             }
               {

               vulUit();

       }

            public void animatie();
       {       while(animatieLopend())
               {       hoek = hoek + 0.1;
                       tekenOpnieuw();
               }
       }

#4 FransHunter

FransHunter

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 09 May 2012 - 08:58 AM

[quote name='FransHunter' timestamp='1336551979' post='23533']
Here are my errors:

error: illegal start of expression Line 54
error: illegal start of expression Line 54
error: ';' expected Line 54
error: illegal start of expression Line 60
error: illegal start of expression Line 60
error: ';' expected Line 60
error: illegal start of expression Line 67
error: ';' expected Line 67
error: reached end of file while parsing Line 83

And here's the code again:



#5 nyccanuck

nyccanuck

    Advanced Member

  • Members
  • PipPipPip
  • 78 posts

Posted 10 May 2012 - 02:52 AM

View PostFransHunter, on 09 May 2012 - 08:58 AM, said:

Here are my errors:

error: illegal start of expression Line 54
error: illegal start of expression Line 54
error: ';' expected Line 54
error: illegal start of expression Line 60
error: illegal start of expression Line 60
error: ';' expected Line 60
error: illegal start of expression Line 67
error: ';' expected Line 67
error: reached end of file while parsing Line 83


We have a difference in language here and I do not understand the methods that you are calling in your code, but think I can still give you some tips.

Firstly, in JCreator, make sure that your curser is in your coding window.  Go up to 'View' and click on 'Show Line Numbers'.
This will at least let you know where you errors are occuring.

Second, your whole file should be somthing like
import ...;
public class classname
{
	some magic here...

	public void Method1
	{
		method 1 code...
	} // end of Method1

	public int Method2
	{
		method 2 code...
		return int;
	} // end of Method2

	private String Method3
	{
		method 3 code...
		return String;
	} // end of Method3

	.
	.
	.

} // end of classname

You still have methods in your code that correct!

Look at vierkant, windmill.

I am assuming that the following
vulAan("rood");
for(int i=0 ; i<4 ; i++)
{
	links(180)
	vooruit(100);rechts(90);
	vooruit(50);links(90);
	vooruit(250);links(90);
	vooruit(200);links(90);
	vooruit(250);links(90);
	vooruit(50);rechts(90);
	vooruit(100);links(90);
	vooruit(100);links(90);
}
{
vulUit();
}
is all part of your void windmill(double z) method???

Remeber that whatever code is part of your method needs to be enclosed in { }.
public void windmill (double z)
{	// opening
	vulAan("rood");
	for(int i=0 ; i<4 ; i++)
	{
		links(180);
		vooruit(100);rechts(90);
		vooruit(50);links(90);
		vooruit(250);links(90);
		vooruit(200);links(90);
		vooruit(250);links(90);
		vooruit(50);rechts(90);
		vooruit(100);links(90);
		vooruit(100);links(90);
	}
	{  // { not necessary if part of this method, as the next line of code will be executed
	vulUit();
	}  // } not necessary
}  // closing windmill() method

Correct some of these types of missing / erroneous errors and your errors should dissapear.
Except for error: reached end of file while parsing Line 83.  To get rid of this one, make sure that every opening {, has a closing }.
JCreator makes it easy, just move your curser to either side of the { or } and it will highlight and show you which brace it is related to.

Hopefully this helps you out.  Let me know if I am missing anything.

#6 Kraicheck

Kraicheck

    Advanced Member

  • Members
  • PipPipPip
  • 880 posts
  • Gender:Male
  • Location:Belgium

Posted 15 May 2012 - 06:44 AM

To make it easier to read for the non-dutch speaking people I translated the code.
This will of course fail to execute.

/**
 * @(#)JavaTest.java
 *
 * JavaTest Applet application
 *
 * @author
 * @version 1.00 2012/4/11
 */

import logodrawap.*;

public class JavaTest extends DrawApplet
{
	   double angle;

	   public void initialise()
	   {	   makeAnimationPossible();
	   }

	   public void drawingprogram()
	   {				penOff();
						step(100,100);
						penOn(150, 75, 0);


					right(angle);
				square(100);

	   }

	   void square(double z)
			  fillOn("rood");
			   for(int i=0 ; i<4 ; i++)
			   {
				forward(150);left(90);
				forward(37.5);left(90);
				forward(150);right(90);
				forward(112.5);left(90);
				forward(37.5);left(90);
				forward(150);right(90);
				forward(112.5);left(90);
				forward(37.5);left(90);
				forward(150);right(90);
				forward(112.5);left(90);
				forward(37.5);left(90);
				forward(150);left(90);
				forward(37.5);
			   }
			   {

			   fillOff();

		  void windmill(double z)
			 fillOn("rood");
			   for(int i=0 ; i<4 ; i++)
			   {
				left(180)
				forward(100);right(90);
				forward(50);left(90);
				forward(250);left(90);
				forward(200);left(90);
				forward(250);left(90);
				forward(50);right(90);
				forward(100);left(90);
				forward(100);left(90);
							 }
			   {

			   fillOff();

	   }

			public void animation();
	   {	   while(animationRunning())
			   {	   angle = angle + 0.1;
					   redraw();
			   }
	   }