Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Cockroach Trap in java programming
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Nataree Kultanawong
Cockroach Trap in java programming
0 Answer(s)      3 years and a month ago
Posted in : Java Beginners


There are many cockroaches in a house and they are very annoying. So, the owner of the house decides to create a number of traps in his house to trap a cockroach in when it walks passing by the trap. If a cockroach is trapped, it will die.

Your program will create a grid of 50x50 tiles with the position of all traps is placed randomly around the grid. The number of cockroaches in the house is given by the user, and their positions are randomly placed on the grid, but not on a trap. Each column of the grid will have at least one trap. Each cockroach walks randomly from tile to tile in all 8 directions (unless it is against the wall) throughout the house. The program will stop when all cockroaches have been trapped, and the time to trap all cockroaches will be displayed.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Cockroach Trap in java programming
Cockroach Trap in java programming  There are many cockroaches... a number of traps in his house to trap a cockroach in when it walks passing by the trap. If a cockroach is trapped, it will die. Your program will create a grid
trap error - Java Beginners
trap error  Hello. Am trying to trap this error that appears when i post blank fields to database. "[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression". what i want is a message cannot post
Advertisements
trap error - Java Beginners
trap error  Hello. Am trying to trap this error that appears when i post blank fields to database. "[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression". what i want is a message cannot post blank
Java Programming
Java Programming  Hi, What is Java Programming? How I can learn Java Programming in one month? Thanks
How to trap Trigger Error - SQL
How to trap Trigger Error  Hi Guys, Can you please help with my problem?.. Is there a way in where I can trap all SQL error and place it under one table? I do search on the net and I found this line of script but I do
Java Programming
Java Programming  Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the student√?¬Ę√Ę‚??¬¨√Ę‚??¬Ęs programming mark. Determine how many student get A+ and A for their grade
Java programming
Java programming  What is the Role of OOP in java
Java programming
Java programming  What is the Role of OOP in java
programming - Java Beginners
programming for java beginners  How to start programming for java beginners
java programming
java programming  Write a Java program that prompt user to input a number of students in a class. Then, prompt user to input the student‚??s programming mark. Determine how many student get A+ and A for their grade and how many
java programming
java programming  how to write a coding for simple login form in netbeans
JAVA PROGRAMMING
JAVA PROGRAMMING  Write an OVERLOADED FUNCTION in java that swaps(interchanges) 2 user given numbers.(one integer and one float value) and displays the result after swapping. Invoke the function in a class
Java Programming
Java Programming  Using Java Frame form, help me develop a GPA calculating device, able to show Grade and points together, and using MySQL database
Java Programming
Java Programming  Using Java Frame form, help me develop a GPA calculating device, able to show Grade and points together, and using MySQL database
java programming
java programming  what is taxonomy tree why we use that concept in java   hierarchical taxonomy is a tree structure of classifications for a given set of objects
java programming
java programming  how to count the no. of constants in a user given string?? plzz help
java programming
java programming  Write a complete Java Program that correctly does the following: prints out first 1000 numbers (not including 1000) with a statement indicating whether it is even or not.. Output: Example Number 0 - Even
java programming
java programming  WAP to calculate the sum of: x + x(square)/2 + x(cube)/3 +.......... x(to the power n)/n
java programming
java programming  Hi friends, if i create one project what are the step i can make...... i need step by step procedure
java programming
java programming  supose i have a text field in java (like in gmail home page u have username field ) so i want to fill that field automatically by taking record from the database so is there any mechanism in java to handle
programming - Java Beginners
Start programming in Java  Programming in Java - Can any one please suggest how to start programming in Java
java programming
java programming  Hi friend if you have any idea about this statement please tel me... String qry1="select * from custentry1 where custid='"+custno
java programming
java programming  Hi friends i need simple login form coding using two labels,two textfields and two buttons in netbeans without using database connection. . if you know that logic please tell
java programming
java programming  Hi, do u have any idea about these lines? Hashtable<Integer,JLabel> labels = new Hashtable<Integer,JLabel>(); labels = new Hashtable<Integer,JLabel>
java programming
java programming  Hi friends, i need a simple login form source code. in that program i have two labels,two text fields and two buttons namely ok and cancel buttons. how to write for that one using netbeans without database
java Programming
java Programming  Based on the following algorithm, write a Java Program Start defining the MyClass class. Declare the class?s myField data field. Initialize the data field. Start defining the SetField() method. Set
Java Programming
Java Programming  Assume that bank maintains two kinds of accounts...://www.roseindia.net/tutorial/java/core/bankAccountApplication.html   thnk...://www.roseindia.net/answers/viewqa/Java-Beginners/27008-q-in-java.html
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code,,????   import org.jfree.chart.*; import org.jfree.chart.plot.PlotOrientation
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code,,????   import org.jfree.chart.*; import org.jfree.chart.plot.PlotOrientation
java programming
java programming  How can be uesd in graphiclly view for user inter (x,y) cordinate and show the output shart point to end point. java code,,????   import org.jfree.chart.*; import org.jfree.chart.plot.PlotOrientation
Java programming
Java programming  Hello! Is anybody able to do this task: I need to find the percentage of words distribution between parts of speech. I have to mark nouns, verbs, adjectives and perpositions like that: to the end of noun
 

 

 

DMCA.com