• Register
0 votes

Problem :

I have following question 
complete the method definition to output the hours given minutes. output for sample program: 3.5
6 5 3
6,930 points

Please log in or register to answer this question.

2 Answers

0 votes

Solution :

One can also use the TimeUnit class

One could define as following

private static final String FORMAT = "%02d:%02d:%02d";
Also can have a method like following:

public static String parseDateTime(long milliseconds) {
      return String.format(FORMAT,
              TimeUnit.MILLISECONDS.toMinutes(milliseconds) - TimeUnit.HOURS.toMinutes(
              TimeUnit.MILLISECONDS.toSeconds(milliseconds) - TimeUnit.MINUTES.toSeconds(
9 7 4
38,600 points
0 votes


Follow the below program i hope you will slove this problem


Challenge 3.2.2: Basic method call.

Complete the method definition to output the hours given minutes. Output for sample program: 
public class HourToMinConv {
    public void outputMinutesAsHours(double origMinutes) {

    double minutesInHour = 60.0;
        System.out.print(origMinutes / minutesInHour);

    public static void main (String [] args) {
        HourToMinConv timeConv = new HourToMinConv();
        // test by running with 210.0, 3600.0, and 0.0.


10 6 4
31,120 points

Related questions

0 votes
1 answer 127 views
Convert seconds to hours, minutes and seconds #include <cstdio> #include <iostream> using namespace std; int main() {      int seconds, hours, minutes;      cin >> seconds;      hours = seconds/3600;      cout << seconds << "seconds is equivalent to" << ... know how to fix this? Whenever I do a number less than 3600, a message appears on the screen stating that the program has stopped working.
asked Aug 27, 2020 sasha 13.2k points
0 votes
1 answer 5 views
Problem: complete the method definition to output the hours given minutes. output for sample program:
asked Feb 23 Muneeb Saadii 4.2k points
0 votes
1 answer 137 views
0 votes
1 answer 14 views
Problem: write code to complete printfactorial()'s recursive case. sample output if userval is 5:
asked Feb 23 Muneeb Saadii 4.2k points
0 votes
1 answer 8 views
Problem: assign total_owls with the sum of num_owls_a and num_owls_b. sample output for the given program:
asked Feb 23 Muneeb Saadii 4.2k points
1 vote
1 answer 134 views
Problem : I am trying to find solution for following error replace any space ' ' by '_' in 2-character string passcode. sample output for the given program:
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 44 views
Problem: I just started Bachelors in Software Engineering. Programming is the main subject of Software Engineering and I have no prior knowledge of programming. My programming teacher gave me an assignment in which I have to write a program in C++ whose output should be as ... a hint: Use nested loop. If someone knows how to do this kindly explain and provide me with the example program. Thanks.
asked Nov 29, 2020 Code Learner 6.5k points
0 votes
1 answer 114 views
Problem : I am unable to understand what am I missing here: Sort my_short_names in reverse alphabetic order. The sample output from the given program as below : ['Tody', 'Samy', 'Joey', 'Jany', 'Anny'] Below is my code for your reference : my_short_names = ['Jany', 'Samy', 'Anny', 'Joey', 'Tody'] my_short_names.sort() print(my_short_names)
asked Jan 8, 2020 alecxe 7.5k points
0 votes
1 answer 874 views
Problem : I learning Python with the help of free online Python tutorial which wants me to write following Program: Create a temperature converter which will convert Fahrenheit values to Celsius and vice-versa using the following two formulas which relate the temperature f in Fahrenheit to ... ,sep ='') if inputString[-1] == 'F': farenheit = inputDigit print(celsiusConvert(farenheit),'C', sep='')
asked Nov 21, 2019 peterlaw 6.9k points