I'm trying to teach myself Java in preparation for a CS class next semester. I've read a few chapters of an introductory Java book. I thought I write a program for fun, where it would take a bunch of times (5 to be exact) and average them. The format would be in min:sec (eg 1:41). My question is that, is there a procedure or method in Java that can check if the ":" is a member of the input? Also are there similar "car" or "cdr" procedures in Java too?
Here's my code:
Thanks a bunch.
Here's my code:
Code:
import java.io.*;
public class cube {
String time;
public static void main (String[] args){
cube [] times = new cube[5];
int x = 0;
while (x < 5){
System.out.print(x);
System.out.print(" Enter your time: ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
times[x] = new cube();
try {
times[x].time = br.readLine();
}
catch (IOException ioe) {
System.out.println("IO error trying to read input!");
System.exit(1);
}
x = x + 1;
}
}
}
Comment