Question

In: Computer Science

Code in java(eclipse) and please use simple codes Assignment Bigfoot has reportedly been seen in Southeast...

Code in java(eclipse) and please use simple codes

Assignment

Bigfoot has reportedly been seen in Southeast Texas forests. We have a drone searching for Bigfoot that can take pictures from the air. During a 24-hour period the drone can fly over the forest 3 times. On each flight we estimate Bigfoot will be in range of the camera on the drone for 2 minutes. The camera can take 10 photos per minute. We estimate there is a 30% chance Bigfoot will appear on each photo taken.

Run a simulation of our drone taking photos of Bigfoot. For each picture taken, generate a random number from 0-100 and compare it to the percentage chance Bigfoot 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 Bigfoot appears in the photo and print that also.

Run the above simulation 5 times. At the end, compute the average number of photos taken (rounded down) during a 24-hour period in which Bigfoot appears (by averaging the number of photos taken of Bigfoot during all of the 5 simulations).

Run your program. Your program must run successfully to receive full credit for this homework. Take a screenshot of your program. The screenshot should show all of your source code and the output of your program in the Console window. Resize the editor and/or console windows as needed so that everything is shown. You may also need to expand Eclipse to full screen size. If you program is too large you can take multiple screenshots so the source code is all shown and zip all the files together (use .zip format only, not .7zip, .rar or any other format besides .zip).

An example of output from the program might look something like:

Simulation 1: Photos of Bigfoot: 33 of 60

Simulation 2: Photos of Bigfoot: 37 of 60

Simulation 3: Photos of Bigfoot: 49 of 60

Simulation 4: Photos of Bigfoot: 40 of 60

Simulation 5: Photos of Bigfoot: 51 of 60

Average photos taken of Bigfoot: 42 of 60

Solutions

Expert Solution

Here is the completed code for this problem. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. Thanks

// BigfootSimulation.java

import java.util.Random;

public class BigfootSimulation {

      public static void main(String[] args) {

            //random number generator

            Random random = new Random();

            //number of times the drone move across the forest in 24 hrs

            int num_times = 3;

            //number of minutes the bigfoot is in range

            int in_range = 2;

            //number of photos taken in a minute

            int photos_per_minute = 10;

            //percentage of a chance of bigfoot in each photo

            int chance = 30;

            //number of simulations

            int num_simulations = 5;

            //finding number of photos in each simulation

            int num_photos_per_simulation=num_times*in_range*photos_per_minute;

            //total of all bigfoot found (to find average)

            int sum = 0;

            //looping through each simulation

            for (int i = 1; i <= num_simulations; i++) {

                  //initializing number of findings to 0

                  int found = 0;

                  //looping for num_photos_per_simulation time

                  for (int j = 0; j < num_photos_per_simulation; j++) {

                        //generating a random value between 0 and 99

                        int percentage = random.nextInt(100);

                        //if this is under chance, incrementing found

                        if (percentage < chance) {

                              found++;

                        }

                  }

                  //displaying number of findings in this simulation

                  System.out.println("Simulation " + i + ": Photos of Bigfoot: "

                              + found + " of " + num_photos_per_simulation);

                  //adding to sum

                  sum += found;

            }

            //finding average and displaying it

            int average = (int) Math.round((double) sum / num_simulations);

            System.out.println("Average photos taken of Bigfoot: "

                        + average + " of " + num_photos_per_simulation);

      }

}

/*OUTPUT*/

Simulation 1: Photos of Bigfoot: 20 of 60

Simulation 2: Photos of Bigfoot: 20 of 60

Simulation 3: Photos of Bigfoot: 17 of 60

Simulation 4: Photos of Bigfoot: 20 of 60

Simulation 5: Photos of Bigfoot: 17 of 60

Average photos taken of Bigfoot: 19 of 60


Related Solutions

Please use Java Eclipse and show code/output Please create a program that determines when a good...
Please use Java Eclipse and show code/output Please create a program that determines when a good day to go to the beach is. Please use the users input and its returning output. If the weather is 70 degree or greater, the program should say yes it is a good day to go If the weather is less than 70 degrees to say no the weather is not a good day to go
This code has to be in java (I code in eclipse). Also these instructions have to...
This code has to be in java (I code in eclipse). Also these instructions have to be followed exactly because if not my output won't match the expected out ( this will be uploaded on zybooks). Write a program that asks the user for their age in days. The program will compute the person's age in years (you can assume that all years have 365 days) and then prints one of the following messages: If the user is 1 year...
PLZ USE ECLIPSE JAVA and show output with explanation The object of this assignment is to...
PLZ USE ECLIPSE JAVA and show output with explanation The object of this assignment is to construct a mini-banking system that helps us manage banking data. Notice that you can copy and paste your code from previous assignments. This assignment asks you to allow read from/write to file, as well as search and sorting algorithm. The object of this assignment is to construct a mini-banking system that helps us manage banking data. This assignment asks you to allow read from/write...
Please create a Java Eclipse code and show output and explanation. MUST USE EXCEPTION! Step 1....
Please create a Java Eclipse code and show output and explanation. MUST USE EXCEPTION! Step 1. Ask users how much money was spent on an orange. Step 2. Then ask the user how many oranges they purchased Step 3. Lastly calculate the price for each orange purchased.
use eclipse give me java codes Task III: Write a classCarInsurancePolicy The CarInsurancePolicy class will...
use eclipse give me java codes Task III: Write a class CarInsurancePolicy The CarInsurancePolicy class will describe an insurance policy for a car. 1. The data members should include all the data members of an Insurance Policy, but also the driver’s license number of the customer, whether or not the driver is considered a “good” driver (as defined by state law) , and the car being insured (this should be a reference to a Car object -- write a separate...
This is Java class working on the eclipse. I include some of the codes just so...
This is Java class working on the eclipse. I include some of the codes just so you know what needed. create and work with interfaces you'll create the DepartmentConstants interface presented. In addition, you'll implement an interface named Displayable that's similar to the Printable interface Create the interfaces 1- Import the project named ch12-ex1_DisplayableTest and review the codes package murach.test; public interface Displayable {     String getDisplayText(); } 2 . Note that this code includes an interface named Displayable that...
USE GENERICS TO WRITE THE JAVA CODE FOR THIS ASSIGNMENT In this assignment, rewrite two of...
USE GENERICS TO WRITE THE JAVA CODE FOR THIS ASSIGNMENT In this assignment, rewrite two of the following sorting methods (Insertion Sort, Selection Sort, Quick Sort, and Merge Sort) to sort ArrayList of objects using Comaprable interface. (60 points)
IN JAVA ECLIPSE PLEASE The xxx_Student class A Student has a: – Name - the name...
IN JAVA ECLIPSE PLEASE The xxx_Student class A Student has a: – Name - the name consists of the First and Last name separated by a space. – Student Id – a whole number automatically assigned in the student class – Student id numbers start at 100. The numbers are assigned using a static variable in the Student class • Include all instance variables • Getters and setters for instance variables • A static variable used to assign the student...
Please use Java eclipse Find pair in an array with given sum Given an array of...
Please use Java eclipse Find pair in an array with given sum Given an array of integers A and an integer S, determines whether there exist two elements in the array whose sum is exactly equal to S or not. Display 1 a pair is found in an array with matching sum S else 0. Input     6     5     1 -2 3 8 7     Where, First line represents integer S. Second line represents the size of an array. Third line represents...
write and explain two dimensional parity check code and hamming codes in simple way please
write and explain two dimensional parity check code and hamming codes in simple way please
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT