hey guys new here and i'm also new to JAVA. i'm taking a class and am kind of stumped in my first assignment
i basically have to write a program that will give the total due a user using an internet cafe.
each full hour = $5.00
each m inute not part of a full hour = $0.10
each second not part of a full minute = $0.01
so far my code looks like:
import java.util.Scanner;
public class AssignmentNo1
{
public static void main(String[] args)
{
int hours, minutes, seconds;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter number of seconds : ");
seconds = keyboard.nextInt();
hours = seconds/3600;
minutes = seconds/60;
seconds = seconds%3600;
System.out.println("Hours used:" + hours);
System.out.println("Minutes used:" + minutes);
System.out.println("Seconds used:" + seconds);
}
}
I have the program running but when I insert a value, it gives me how many seconds in that hour, how many seconds in that minute and h ow many seconds in that second. i need it to be left over, not new each time.
for example this is what i have NOW:
Enter number of seconds : *enter*230
hours used: 0
minutes used: 3
seconds used: 230
i want it to do THIS:
Hours used: 0
minutes used: 3
seconds used: 50
can anyone help? THANKS A LOT