• 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

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 30 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 sasha 3.5k points
1 vote
1 answer 106 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 8 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 4 days ago Sheeza 4k points