You have to create a world class that contains a 2d array

Assignment Help JAVA Programming
Reference no: EM13372098

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

public void move()

{

   Random r = new Random();

    int a = r.nextInt(4);

   if (a == 0)

       {

           if (y - 1 >= 0 && world.getAt(x, y - 1) == null)

               {

                  y -= 1; world.setAt(x, y, this);

                }

        }

  else if (a == 1)

   {

        if (y + 1 < World.WORLDSIZE && world.getAt(x, y + 1) == null)

             {

                  y += 1; world.setAt(x, y, this);

              }

   }

 else if (a == 2)

 {

          if (x - 1 >= 0 && world.getAt(x - 1, y) == null)

                { 

                     x -= 1; world.setAt(x, y, this);

                  }

   }

 else if (a == 3)

  {

          if (x + 1 < World.WORLDSIZE && world.getAt(x + 1, y) == null)

                   {

                        x += 1; world.setAt(x, y, this);

                    }

   }

Download:- java class.zip

Reference no: EM13372098

Questions Cloud

1 introductionin order to debug an application it is : 1 introductionin order to debug an application it is sometimes useful to know where a given object comes from or where
Huang is the son of successful malaysian business people : huang is the son of successful malaysian business people and works for his parents company. huang owns a home in a
1 ross whites machine shop uses 2500 brackets during the : 1. ross whites machine shop uses 2500 brackets during the course of the year and this usage is relatively constant
Create functions in filehow to code this functiondeclare : create functions in filehow to code this functiondeclare function inputs and outputsdownload-
You have to create a world class that contains a 2d array : you have to create a world class that contains a 2d array then create an abstract class called organism that contains
1 using the following fixed basket of goods basket 6 : 1. using the following fixed basket of goods basket 6 pizzas 12
Lee is taking some friends on a picnic theyll need to : lee is taking some friends on a picnic. theyll need to follow a path to get to the picnic spot. a map of the path is
1 the brain drain problem in the developing countries : 1. the brain drain problem in the developing countries refers to the fact the best-educated workersa. often emigrate to
Casea beautiful harbor town has the following : casea beautiful harbor town has the following characteristics it is located on an island that is mostly except for the

Reviews

Write a Review

JAVA Programming Questions & Answers

  What are the values of these boolean expressions

Describe the steps for inserting a new item at the head of a linked list? Make sure you consider all possible incoming conditions.

  Create four classes

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

  Need the build function.use recursion

Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provided. Use given material to receive points. Implement remaining function. Everything else is provide..

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

  Traditionally-nutrition programs were targeted to indigent

Traditionally, nutrition programs were targeted to the indigent and poor populations in developing countries. Many of today's Americans are malnourished also, but they are glutted with a wealth of unhealthy foods and require a multidisciplinary appro..

  Implement a game called bunko-poker

Implement a game called Bunko-Poker. The gameplay is an easily programmed version of the popular game Yahtzee. Your program will make use of the supplied static functions Dice.roll() and, in cases where you might need the string ordered, Dice.ordered..

  Organization structure change over time

How and why did the organization structure change over time, and in what ways were some of these changes responsible for some of their recent problems?

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

  Write a program that prompts the user to enter an integer

Using && and || write a program that prompts the user to enter an integer and determine whether it is: Evenly divisible by 5 AND 6.

  Java script program for song

Construct a JavaScript program that declares and prints an array that includes at least twenty of your favorite songs.

  Solution for the problem and mention algorithms

Explain the purpose of the program as detail as possible and develop a solution for the problem and mention algorithms to be used and list data structures to be used in solution.

  Write program in java-calculate and display mortgage payment

Write the program in Java (with a graphical user interface) and have it calculate and display the mortgage payment amount from user input of the amount of the mortgage.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd