who knows java?
Posted: Thu Mar 13, 2008 6:41 am
Hey all,
i need some help with someone who knows a bit of java. Ive just started it in uni and having trouble getting a program to compile.
I need to make a program that can display 4220 seconds as hours:minutes:seconds and then skip a line then do the same for 2500seconds.
heres what i have so far:
/**
* Converts two different number of seconds to hours:minutes:seconds.
*
*/
public class TimeChanger
{
public static void main(String[] args)
{
int time = 4220;
int hours = time / 3600;
int hoursRemainder = time % 3600;
int minutes = hoursRemainder / 60;
int minutesRemainder = hoursRemainder % 60;
int seconds = minutesRemainder;
System.out.println(“4220 seconds:" +hours ":" +minutes ":" +seconds);
int time = 2500;
int hours = time / 3600;
int hoursRemainder = time % 3600;
int minutes = hoursRemainder / 60;
int minutesRemainder = hoursRemainder % 60;
int seconds = minutesRemainder;
System.out.println(“4220 seconds:" +hours ":" +minutes ":" +seconds);
}
}
im using blueJ as my editing tool and its coming up with an illegal character on the first print line.
any help would be much appreciated
i need some help with someone who knows a bit of java. Ive just started it in uni and having trouble getting a program to compile.
I need to make a program that can display 4220 seconds as hours:minutes:seconds and then skip a line then do the same for 2500seconds.
heres what i have so far:
/**
* Converts two different number of seconds to hours:minutes:seconds.
*
*/
public class TimeChanger
{
public static void main(String[] args)
{
int time = 4220;
int hours = time / 3600;
int hoursRemainder = time % 3600;
int minutes = hoursRemainder / 60;
int minutesRemainder = hoursRemainder % 60;
int seconds = minutesRemainder;
System.out.println(“4220 seconds:" +hours ":" +minutes ":" +seconds);
int time = 2500;
int hours = time / 3600;
int hoursRemainder = time % 3600;
int minutes = hoursRemainder / 60;
int minutesRemainder = hoursRemainder % 60;
int seconds = minutesRemainder;
System.out.println(“4220 seconds:" +hours ":" +minutes ":" +seconds);
}
}
im using blueJ as my editing tool and its coming up with an illegal character on the first print line.
any help would be much appreciated