I need to help in the project I mention below:

The project involves the simulation of a cockroach jumping pathway that accidentally dropped from the aspirator unit onto the center of a hot plate of a hamburger parlor. Due to hot plate temperature (220oC) the bug jumps randomly anywhere being incapable of sensing the environment with its antenna. Being exposed to unusual temperature, the structure of its legs/feet limits the number of jumps. If it passes over the border of the hotplate then it survives with fried legs but if it cannot then it becomes a part of the food to be served! You are expected to come up with a program which simulates the random track of the bug and determines whether it survives. Then the program applies the simulation to 1000 bugs to have statistical values of average survival percent and average escape time of the survivors.. Refer to your textbook and other java sources for the use of randomize function of Java.

Description of the existing case

The project describes the simulation of a cockroach jumping pathway that accidentally dropped from the aspirator unit onto the center of a hot plate of a hamburger parlor. Due to hot plate temperature (220oC) the bug jumps randomly anywhere being incapable of sensing the environment with its antenna. Therefore, the angle of the jump with respect to horizontal line is randomly created in the range [0o -359o]. Each jump takes exactly 1 second and forwards 3cm. Being exposed to this unusual temperature, the structure of its legs/feet limits the number of jumps to a maximum of 70.The dimensions of the hotplate are set to 100 cm by 60 cm. If it passes over the border of the hotplate then it survives with fried legs but if it cannot then it becomes a part of the food to be served! You are expected to come up with a program which simulates the random track of the bug and determines whether it survives or not. Then the program applies the simulation to 1000 bugs in order to have statistical values of average survival percent and average escape time of the survivors.

How to simulate?

The first approach in the program is to determine if a single bug survives or not. In order to achieve this, you should write a sound code simulating the track of the bug. Please bear in your mind that you need to coordinate the hotplate and simulate the jumps in a randomly manner while keeping track of your bugâ€™s coordinates if the bug is out of bounds or not. Do not forget the maximum allowable jumps for each bug, 70. Certainly you need to have a time counter for the bugs that survived and also a number counter for the survivors. It is a good practice to use arrays to keep track of the changing values for each bug in question. The program should run 1000 times to simulate the fate of 1000 bugs! Please be aware of the fact that each simulation of the bug is independent of the others, thus be careful with the implementation of the random expression you will use.

This is my program code but there has been said a mistake

``````import java.io.*;
import java.util.Random;

public class ourjumpingbugs{

public static void main(String [] args ){

double x   =0;
double y   =0;
double alive =0;
double angle =0;
double time =0;
double totaltime =0;

for(int b=0; b < 1000 ; b++ ){

for(int d=0; d<70 ; d++){

Random randomtemperature = new Random (); // Our bugs are jumping in the interval 0-359 degrees randomly

int degree = randomtemperature.nextInt(359);
angle = ((2*Math.PI*degree)/ 360);
x = x +3*Math.cos(angle);
y = y +3*Math.sin(angle);

// The control of the conditions to survive our bugs

if((x > 50 || x < -50) || (y > 30 || y < -30)) {

alive++;                        // Counting of alive bugs
totaltime += time;
x=0;
y=0;

break;

}
time++;
}

time=0;
}

double k = (((alive)/1000)*100);
double j = ((totaltime)/(alive));
// Data display and calculation

System.out.println ( "                    []                                               ") ;
System.out.println ( "                  [][][]                                            ") ;
System.out.println ( "                [][][][][]                                         ") ;
System.out.println ( "              [][][][][][][]                                      ") ;
System.out.println ( "                     *                                               ") ;
System.out.println ( "                                                                      ") ;
System.out.println ( "                     *                                               ") ;
System.out.println ( "                                                                      ") ;
System.out.println ( "                     *                                               ") ;
System.out.println ( "                                                                      ") ;
System.out.println ( "           /===================== /         ") ;
System.out.println ( "          /                                                /          ") ;
System.out.println ( "         /           *                                   /           ") ;
System.out.println ( "        /                                                /            ") ;
System.out.println ( "       /                                                /             ") ;
System.out.println ( "      /=====================/              ") ;
System.out.println ( "                                                                      ") ;
System.out.println ( "                                                                      ") ;
System.out.println ( " 1000 numbers of bugs are falling down from air condition exactly to the centre(middle point) of hot plate");
System.out.println ( "The vital datas of bugs under these conditions:                      ");
System.out.println ( " The percentage of alive bug = "+ " %"+ k);
System.out.println ( " The average escaping time of bugs = "+j+" second");

}
}``````

I have to give until this friday if anyone help me I will be very pleased...

What error are you getting? Where do you need help? Can you identify any portion of your code that isn't working as you expect it to? If so, how do you expect it to work?

If you can't answer these questions, don't bother posting a question on this site because nobody cares and nobody is going to read your entire project description to help you. (But if your teacher does a quick google search, you just got a 0). The question I bolded is perhaps the most important, because if you can't do so, then you either

A) haven't written enough code to come across any that isn't working
B) didn't make any effort in helping yourself, so why should we help you?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.