Ask Question
5 February, 09:34

Complete the method definition to output the hours given minutes. Output for sample program:3.5import java. util. Scanner; public class HourToMinConv { public static void outputMinutesAsHours (double origMinutes) { / * Your solution goes here * / } public static void main (String [] args) { Scanner scnr = new Scanner (System. in); double minutes; minutes = scnr. nextDouble (); outputMinutesAsHours (minutes); / / Will be run with 210.0, 3600.0, and 0.0. System. out. println (""); }}

+5
Answers (1)
  1. 5 February, 13:18
    0
    import java. util. Scanner;

    public class num1 {

    public static void outputMinutesAsHours (double origMinutes) {

    double hours = origMinutes / 60;

    System. out. println ("The converted hours is " + hours);

    }

    public static void main (String[] args) {

    Scanner scnr = new Scanner (System. in);

    double minutes;

    minutes = scnr. nextDouble ();

    outputMinutesAsHours (minutes); / / Will be run with 210.0, 3600.0,

    System. out. println ("");

    }

    }

    Explanation:

    The question required us to only write the statement to complete the line

    outputMinutesAsHours (double origMinutes) { / * Your solution goes here * / }

    The solution double hours = origMinutes / 60; solves this because there are 60 minutes in one hour, so to conver minutes to hours, you divide the number of minutes by 60
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Complete the method definition to output the hours given minutes. Output for sample program:3.5import java. util. Scanner; public class ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers