|  | 
|  | 
| back to board | Help WA Test #7  
 Edited by author 07.03.2010 10:26
Re: Help WA Test #7 Hi,
 Alright guys I have solved the problem. Being a newbie to c# caused me to submit program 35 times. I didn't realize that Math.Round() function will change 100.00 to 100 instead. Here are the lines which I changed.
 
 double miles = distance(ship_latitude_radian, ship_longitude_radian, iceberg_latitude_radian, iceberg_longitude_radian);
 if (Math.Round(miles, 2) < 100.00)
 {
 Console.WriteLine("The distance to the iceberg: {0:F2} miles.", miles);
 Console.WriteLine("DANGER!");
 }
 else
 {
 Console.WriteLine("The distance to the iceberg: {0:F2} miles.", miles);
 }
Re: Help WA Test #7 Posted by r1d1  17 Aug 2009 20:02s=floor(s*100+0.5)/100.0Re: Help WA Test #7 Solved by making the following comparison in java:
 if (Math.round(distance*100) < 10000) {
 System.out.println("DANGER!");
 }
 
 it will force it to compare with 2 digits precision.
 | 
 | 
|