My issue is with the "if" statement. Basically I want the program to have proper grammar when it states, "1 hour, 1 minute, 1 second", instead of "1 hours, 1 minutes, 1 seconds".
See what I mean? I gave it a go with "hours" but with no success.
Plus any advice as to how I could've made this program simpler. Keep in mind my knowledge of Java is limited. I'm currently learning it. So please don't bring up advanced methods of making it simpler. I'm limited to a broad knowledge of conditionals and loops (which I vaguely understand).
Thank you kindly!
//This program will convert the user's input of seconds into a combination of hours, minutes, and seconds
import java.util.Scanner;
public class Project7
{
public static void main (String[]args)
{
int hrs,minutes,seconds,total;
String time;
Scanner scan = new Scanner (System.in);
System.out.println("Please enter the amount of seconds to be converted ");
total = scan.nextInt();
hrs = total / 3600;
minutes = (total % 3600) / 60;
seconds = (total % 3600) % 60;
if (hrs < 2)
time = hour;
else
time = hours;
System.out.print(total + " seconds is " + hrs + time + minutes + " minutes and " + seconds + " seconds");
}
}