Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

FinalExam Review Spring2007: Make a Super Truck

Back to Final Review-Spring 2007

Questions? Answers? Comments?


wouldn't 50% as much be 5 - 10, not 20 - 30

return 10+ randNumGen.nextInt(11);

double delay = randNumGen.nextGaussian()+3;

what does (11) after nextInt accomplish?? and does randomNumGen generate a random decimal b/n 0 and 1 or any number? also, what does nextGaussian do?? sorry i know thats a lot of questions
randNumGen.nextInt(11) generates an integer at random between 0 and 11. Since the load size is between 10
and 20, 10 + randNumGen.nextInt(11) creates a number at random between 10 and 20

Am I on the right track?
Modifications made to the Truck class to produce supertrucks:

return 20+randNumGen.nextInt(11);

double delay = randNumGen.nextGaussian()2;

public int newLoad() {
return 10+randNumGen.nextInt(21);
}

public double tripTime(){
double delay = randNumGen.nextGaussian()+2;
if (delay .3){
return .3 + ((DESimulation) simulation.getTime();}
else{return delay + ((DESimulation) simulation).getTime();}
}

I also htink we only need to modify these two lines:

return 20+randNumGen.nextInt(11);
double delay = randNumGen.nextGaussian()+ 2;



Link to this Page