Question
Java Assignment: An alien has reportedly been seen in Southeast Texas forests. We have an airplane searching for the alien that can take pictures from
Java Assignment: An alien has reportedly been seen in Southeast Texas forests. We have an airplane searching for the alien that can take pictures from the air. During a 24 hour period the airplane can fly over the forest 6 times. On each flight we estimate the alien will be in range of the camera on the airplane for 2 minutes. The camera can take 10 photos per minute. We estimate there is a 40% chance the alien will appear on each photo taken. Run a simulation of our airplane taking photos of the alien. For each picture taken, generate a random number from 0-100 and compare it to the percentage chance that the alien will appear in the photo. Calculate the number of photos taken during the 24 hour period and print it. Calculate the number of photos taken during 24 hour period in which the alien appears in the photo and print that also. Run the above simulation 4 times. At the end, compute the average number of photos taken (rounded down) during a 24 hour period in which the alien appears (by averaging the number of photos taken of the alien during all of the 4 simulations).An example of output from the program might look something like:
Simulation 1: Photos of the alien: 43 of 120
Simulation 2: Photos of the alien: 35 of 120
Simulation 3: Photos of the alien: 59 of 120
Simulation 4: Photos of the alien: 55 of 120 Average photos taken of the alien: 48 of 120
Pseudocode from professor, TRY TO KEEP IT IN THIS FORMAT PLEASE:
// Pseudocode for Homework 4 - Alien problem class code { void main () { int r; // random # from 0-100 int numSims; // counts from 1-4 int numPics; // counts to 120 int numPicsAlien; // # of pics of the alien on 1 sim int totalPicsAlien=0; // over all 4 sims (divide by 4 after all sims to get average) loop 4x { // use the variable numSims as the counter //run a sim - 120 photos numPicsAlien = 0 loop 120x { // use numPics as the counter r = generate random integer from 0-100 if (r <= 40) numPicsAlien++ } print "Simulation " + numSims + ": Photos of the alien: " + numPicsAlien + " of 120" totalPicsAlien += numPicsAlien } print "Average photos taken of the alien: " + totalPicsAlien / 4 + " of 120"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started