Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. /*-----------------------------------------------
  2. Name: David Igou
  3. Block: B4
  4. Program: Calculating Splits
  5. Date: 9/28/10
  6.  
  7. Description: Calculates splits in a race from lap mile times
  8. -----------------------------------------------*/
  9.  
  10. import java.io.*;
  11. import java.util.Scanner;
  12.  
  13. class splits_DIgou{
  14. public static void main (String arg[]) throws IOException {
  15.  
  16.  
  17. //Mile 1
  18.  
  19. Scanner scan = new Scanner(System.in);
  20.  
  21. System.out.println("***Mile 1***");
  22.  
  23. System.out.println("Enter Minute");
  24. int M1 = scan.nextInt();
  25. System.out.println("Enter Second");
  26. int S1 = scan.nextInt();
  27. System.out.println("Enter Hundreths of a second");
  28. int MS1 = scan.nextInt();
  29.  
  30. int TotalMS1 = ((M1 * 6000) + (S1 * 100) + (MS1));
  31. System.out.println(TotalMS1);
  32.  
  33.  
  34. System.out.println();
  35.  
  36. //Mile 2
  37.  
  38. System.out.println("***Mile 2***");
  39.  
  40. System.out.println("Enter Minute");
  41. int M2 = scan.nextInt();
  42.  
  43. System.out.println("Enter Second");
  44. int S2 = scan.nextInt();
  45.  
  46. System.out.println("Enter Hundreths of a second");
  47. int MS2 = scan.nextInt();
  48.  
  49. int TotalMS2 = ((M2 * 6000) + (S2 * 100) + (MS2));
  50. System.out.println(TotalMS2);
  51.  
  52. //Mile 3
  53.  
  54. System.out.println("***Mile 3***");
  55.  
  56. System.out.println("Enter Minute");
  57. int M3 = scan.nextInt();
  58.  
  59. System.out.println("Enter Second");
  60. int S3 = scan.nextInt();
  61.  
  62. System.out.println("Enter Hundreths of a second");
  63. int MS3 = scan.nextInt();
  64.  
  65. int TotalMS3 = ((M3 * 6000) + (S3 * 100) + (MS3));
  66. System.out.println (TotalMS3);
  67.  
  68. //Split One
  69.  
  70. System.out.println ("***Split 1***");
  71. System.out.println (M1 + ":" + S1 + "." + MS1);
  72.  
  73.  
  74. //Split Two
  75.  
  76. System.out.println ("***Split 2***");
  77.  
  78. int Split2Huns = ((TotalMS2) - (TotalMS1));
  79. System.out.println ("Split 2 Hundreds: " + Split2Huns);
  80.  
  81. int Split2Mins = ((Split2Huns) / (6000));
  82. System.out.println ("Split 2 Minutes: " + Split2Mins);
  83.  
  84. int Split2Secs = ( ((Split2Huns) % 6000) / 100);
  85. System.out.println ("Split 2 Seconds: " + Split2Secs);
  86.  
  87. int Split2HSecs = ( ((Split2Huns) % 6000) % 100);
  88. System.out.println ("Split 2 Hyndreths of a Seconds: " + Split2HSecs);
  89.  
  90. System.out.println ("Split 2: " + Split2Mins + ":" + Split2Secs + "." + Split2HSecs);
  91.  
  92. //Split three
  93. System.out.println ("***Split 3***");
  94.  
  95. int Split3Huns = ((TotalMS3) - (TotalMS2));
  96. System.out.println ("Split 3 Hundreds: " + Split3Huns);
  97.  
  98. int Split3Mins = ((Split3Huns) / (6000));
  99. System.out.println ("Split 3 Minutes: " + Split3Mins);
  100.  
  101. int Split3Secs = ( ((Split3Huns) % 6000) / 100);
  102. System.out.println ("Split 3 Seconds: " + Split3Secs);
  103.  
  104. int Split3HSecs = ( ((Split3Huns) % 6000) % 100);
  105. System.out.println ("Split 3 Hundreths of a Seconds: " + Split3HSecs);
  106.  
  107. System.out.println ("Split 3: " + Split3Mins + ":" + Split3Secs + "." + Split3HSecs);
  108.  
  109. //Sexy ending
  110.  
  111.  
  112. System.out.println ("******************************************");
  113. System.out.println ("*\t\tSplits\t\t\t *");
  114. System.out.println ("*\t\t\t\t\t *");
  115. System.out.println ("*Split 1: \t\t\t " + M1 + ":" + S1 + "." + MS1 + "*");
  116. System.out.println ("*Split 2: \t\t\t " + Split2Mins + ":" + Split2Secs + "." + Split2HSecs + "*");
  117. System.out.println ("*Split 3: \t\t\t " + Split3Mins + ":" + Split3Secs + "." + Split3HSecs + "*");
  118. System.out.println ("*Finish Time: \t\t\t " + M3 + ":" + S1 + "." + MS1+ "*");
  119. System.out.println ("******************************************");
  120. System.out.println ();
  121.  
  122.  
  123.  
  124.  
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement