Hello, im new to programming, and im learning how, but i wanted to try to make some sort of program that will tell you how long you are at a place, such as work or school.

I call it the "School Calculator"

So it works like this:

You enter when your school starts, lets say 4
You enter when your school ends, lets say 530
You enter weather this is AM or PM, lets say there both PM
It will then tell you:

"You school is 1 hour, 30 minutes long."

Now i coded this almost perfuctly, it will tell you this, but it will put everything as just a regular number, like "Your school is 130 hours long"

So I relised im going to need some sort of 24-hour clock, so that i can brake it into minutes.

Can anyone tell me how to:

Make it treat every number as "time" and once it reaches 60 minutes, it turns into 1 hour, after it will display the 60 minutes section (the hours) into a diffrent catagory, so it will say in the code "your school is" + hours + " and " + minutes + "long"

Here is my code for this school calculator:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Random;

public class MultiPro
{
public static void write (String text)
{
System.out.print (text);
}


public static void writeLine (String text)
{
System.out.println (text);
}


public static void write (int number)
{
System.out.print (number);
}


public static void writeLine (int number)
{
System.out.println (number);
}


public static void write (char character)
{
System.out.print (character);
}


public static void writeLine (char character)
{
System.out.println (character);
}


public static String readString ()
{
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
String var = "";
try
{
var = br.readLine ();
}
catch (IOException ioe)
{
System.out.println (ioe.toString ());
}
return var;
}


public static int readInt ()
{
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
String tempVar = null;
try
{
tempVar = br.readLine ();
}
catch (IOException ioe)
{
System.out.println (ioe.toString ());
}
int var = Integer.parseInt (tempVar);
return var;
}


public static char readChar ()
{
BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
char var = 0;
try
{
var = (char) br.read ();
}
catch (IOException ioe)
{
System.out.println (ioe.toString ());
}
return var;
}


public static int randomInt ()
{
Random rnd = new Random ();
int number = rnd.nextInt (1) * 3;
return number;
}


public static char randomChar ()
{
Random rnd = new Random ();
char character = (char) (rnd.nextInt (1) * 3);
return character;
}

public static void main (String args[])
{
int num1;
int num2;
int time1=0;
int time2;
String name = null;
char op = 0;
int op1;
int age;
int sum;
int result;
int result2;
char pass = 0;
char next = 0;
int answer;
int total;
char timeframe;
char no = 0;
int soc1=0;
int soc2=0;
int soc3=0;
int soc4=0;
int soc5=0;
int soc6=0;
int grade;
char rank;
int minlength = 10;

// Option 4

if (op1 == 4)
{
writeLine ("School Calculator selected!");
writeLine ("");
write ("When does your school start: ");
time1 = readInt ();
writeLine ("");
writeLine ("AM or PM?");
timeframe = readChar ();
if(time1>59){
time1++;
}
write ("When does your school end: ");
time2 = readInt ();
answer = time2 - time1;
writeLine ("AM or PM?");
timeframe = readChar ();
writeLine ("Your school is: " + answer + " hours long.");
writeLine ("*This program is in debug mode, and is still being worked on*");
writeLine ("");
writeLine ("Back to menu? (Y|N)");
writeLine ("");
op = readChar ();
}