id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > quiz2021_12_08_APSLHL_timeDiff
prev  |  next  |  chance

Write a method that returns the time difference, in minutes, between two times given in 24 hour format for the same day. The first time is 'hrs1':'min1' and the second time is 'hrs2':'min2'. The time difference is how far apart those two times are, in minutes. For example: 5:15 and 5:45 are 30 minutes apart. 2:00 and 14:00 are 12 hours apart, but that is 720 minutes apart. The difference between times is the same no matter the order. So 5:15 and 5:45 are 30 minutes apart, but so are 5:45 and 5:15. Look at the test data for examples. Remember, this is using 24 hour time, so 1:00 PM is 13:00, and 2:00 PM is 14:00.


quiz2021_12_08_APSLHL_timeDiff(4, 15, 5, 45) → 90
quiz2021_12_08_APSLHL_timeDiff(1, 5, 7, 8) → 363
quiz2021_12_08_APSLHL_timeDiff(5, 12, 3, 1) → 131

...Save, Compile, Run (ctrl-enter)

public int quiz2021_12_08_APSLHL_timeDiff(int hrs1, int min1, int hrs2, int min2) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 230

Copyright Nick Parlante 2017 - privacy