/* Hi guys, im been working a while with following code and now im really stuck
* The code asks the user to put in the startime for a runner in a race and then the finishing time.* Then it converts the hh/mm/ss into seconds.
* The last step is to convert the seconds into hh/mm/ss to show the total amount of time it took* for the runner to complete the track.
* So, how do i convert the seconds into hh/mm/ss??????? ;(
*/
package test;
import javax.swing.*;
/**
*
* @author torstensson
*/
public class test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
//Starttime input
String strT1 = JOptionPane.showInputDialog("Starttime hour" );
String strM1 = JOptionPane.showInputDialog("Starttime min" );
String strS1 = JOptionPane.showInputDialog("Starttime sec" );
System.out.println("Starttime:\n" + "---------\n" +
"Hour: " + strT1 + "\n" + "Min: " + strM1 + "\n" +
"Sec: " + strS1 + "\n");
//Finishingtime input
String strT2 = JOptionPane.showInputDialog("Finishing hour" );
String strM2 = JOptionPane.showInputDialog("Finishing min" );
String strS2 = JOptionPane.showInputDialog("Finishing sec" );
System.out.println("Finishingtime :\n" + "---------\n" +
"Hour: " + strT2 + "\n" + "Min: " + strM2 + "\n" +
"Sec: " + strS2 + "\n");
//Converting variables
int intT1 = Integer.parseInt(strT1);
int intM1 = Integer.parseInt(strM1);
int intS1 = Integer.parseInt(strS1);
int intT2 = Integer.parseInt(strT2);
int intM2 = Integer.parseInt(strM2);
int intS2 = Integer.parseInt(strS2);
//Calculation of input
int sumintT2 = intT2 * 3200;
int sumintM2 = intM2 * 60;
int sumintT1 = intT1 * 3200;
int sumintM1 = intM1 * 60;
int totSek = sumintT2 + sumintM2 - sumintT1 - sumintM1;
System.out.println(totSek);
//???????
}
}