java - Location class that keeps track of x and y -


I am doing a practice for school where I have to write a program that keeps track of the position of X Within a grid

  • move the figures below () above.
  • Left () moves the figure on the left.
  • Correct () takes accurate data.
  • This is so far from me and the problem is that I get 0,0 when running the program.

    I'm not good at programming, I'm sorry if that's really bad.

      Package øving_1; Public Square Location {Private Intex XX; Private int yAkse; Public place () {xAkse = 0; YAkse = 0; } Public Zero Correct (int i) {xAkse ++; } Private zero free {xAkse--; } Private Wide Up (i.e. eye) {yAkse--; } Private zero below (int i) {yAkse ++; } Public int getPosition () {return xAkse; } Public int getPosition2 () {return yAse; } Public static zero main (string [] args) {location location = new location (); Location.right (0); Location.left (0); Location.up (0); Location.down (0); System.out.print ("Posisjonen til x, y er:"); System.out.print (location.getPosition () + "," + location.getPosition2 ()); }}  

    i argument is not used , But the rest of the code is correct.

    It's okay what you would expect: if you take one step right, then one step left, then one step up, then one step down, you again the place where you were in the beginning .

    This geometry is Baby.


    Comments

    Popular posts from this blog

    python - Overriding the save method in Django ModelForm -

    html - CSS autoheight, but fit content to height of div -

    qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -