@ -1,11 +1,25 @@
package seng302 ;
import java.util.Scanner ;
public class App
{
public static void main ( String [ ] args )
{
int factor = 200 ; // Scale 5 min to 1 min
if ( args . length > 0 & & args [ 0 ] . equals ( "-5" ) ) factor = 1000 ; // 1:1 scale
int timescale = 0 ; // Scale 5 min to 1 min, 1min = 200 5 min = 1000
Scanner sc = new Scanner ( System . in ) ;
while ( timescale ! = 1 & & timescale ! = 5 ) {
System . out . println ( "Enter whether you wish the race to last 1 or 5 minutes." ) ;
String input = sc . nextLine ( ) ;
try {
timescale = Integer . parseInt ( input ) ;
} catch ( Exception e ) {
System . out . println ( "Please Enter a 1 or 5." ) ;
}
}
timescale = timescale = = 1 ? 200 : 1000 ; //200ms = 1000ms if 1 minute elapse else 1000ms = 1000ms if 5 minutes
Boat [ ] boats = {
new Boat ( "ORACLE TEAM USA" , 11 ) ,
@ -25,7 +39,7 @@ public class App
new RaceMarker ( "Finish" , 3035 , 475 , 1015 )
} ;
Race race = new ConstantVelocityRace ( boats , marks , factor ) ;
Race race = new ConstantVelocityRace ( boats , marks , timescale ) ;
race . simulateRace ( ) ;
}
}