33.7k views
3 votes
Write a program that accepts a number of minutes and converts it both to hours and days. for example, 6000 minutes equals 100 hours and equals 4.167 days. save the class as minutesconversion.java.

1 Answer

4 votes
public class MinToHrDays {
/** * @param args the command line arguments */
public static void main(String[] args) {
// TODO code application logic here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the number of minutes: ");
try {
Float fltNumMins = Float.parseFloat(reader.readLine());
Float fltHrs = fltNumMins /60;
Float fltDays = fltHrs / 24;
System.out.println("Minutes: " + fltNumMins + " Hours: " + fltHrs + " Days: " + fltDays);
} catch (IOException e) {
System.err.println("Error: " + e);
}
}
}
User Prolfe
by
5.8k points