DiscreteEventSimulator

DiscreteEventSimulator - eventTime =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 //REMEMBER TO CHANGE THE FILE EXTENSION TO .JAVA FOR THIS TO WORK IN A COMPILER!!! import java.util.* public class DiscreteEventSimulator{ static int eventTime = 0 static int simulationTime = 0 static int time = 0 static int eventCounter = 0 public static void main(String[]args){ Scanner scan = new Scanner(System.in) System.out.println("enter a number for simulation time") simulationTime = scan.nextInt()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: eventTime = (RandomData.getInt('E', 5, 00)) System.out.println(eventTime) while(time <= simulationTime){ while(time == eventTime){ eventCounter++ System.out.println("minute:" +" " +time+ " "+ "event#" + " " + eventCounter) eventTime += (RandomData.getInt('E', 5, 00)) } time++ } System.out.println("Number of events = " + eventCounter) } }...
View Full Document

This note was uploaded on 04/07/2008 for the course CS 116 taught by Professor Koutsogiannakis during the Spring '08 term at Illinois Tech.

Ask a homework question - tutors are online