0
import java.util.Scanner;

public class EventFrequency {

/**
* main method:
* ask the user for the average number of events per time interval
* (lambda) and the number of time intervals to observe
* draw a horizontal and vertical histogram of the number of heads
*/
public static void main(String[] args) {

// set up to get user input
Scanner scan = new Scanner(System.in);

// ask user for the average number of events per time interval
System.out.println("What average number of events per time interval do you want?");
int lambda = scan.nextInt();

// ask user for the number of time intervals to observe
System.out.println("How many time intervals do you want to observe?");
int times = scan.nextInt(); 

// instantiate a Poisson object named myDist with average number of events
Poisson myDist = new Poisson(lambda);

// step 1:
// declare an int array named "counts" to count coin flip occurences
// make its size one larger than 3 * lambda 





// step 2:
// initialize all of the values in the counts array to 0




// step 3:
// count the number of events occurring in each time interval observed





// step 4:
// print out the estimated probabilities of zero events and lambda events





// step 5:
// instantiate an object of the Histogram class with 
// the array to be drawn, the indices of valid data,
// and the maximum length of the bars in the histogram
//
// call its draw methods to draw the two histograms





}
}

Edited by Ezzaral: Formatted code. Now you just need to post specific questions, because no one is going to finish the assignment for you.

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by NormR1
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.