public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
DecimalFormat fmt = new DecimalFormat();
fmt.toPattern("##.##.##");
System.out.print("Enter a Time, no decimals");
int time = scan.nextInt();
System.out.println("Time: " + fmt.applyPattern(time));
}
one of my lame efforts to get the following to work.
I'm writing a program for the Track coach to sort runners by time, and then assign them to a specific lane on the track. Easy peasy...
Problem. They need to give me up to a 6 digit number, and would prefer to get the number back in the following format "##:##.##"
I had thought of having them enter the 2 digit groups separately, but that would entail 3 sorts. I thought that them entering the time as a 6 digit number would let me do 1 sort, then I could reformat the number. I'm trying to find a method in Java, but no luck so far. As you can see, I'm spending more time on this, instead of the actual real program. Of course this is a sticking point, because if I take the easy way out, and have them enter 3 groups of 2 digits, I have to do a sort, then up to 10 subsort, and then...even more....
Hey, I could always send the number to a string and break it up and concatinate to get the right symbols....wow, that would be almost as painful.
I hope someone has a bright idea, I'm feeling rather stupid...
austinious

New Topic/Question
Reply




MultiQuote




|