View Single Post
  #1 (permalink)  
Old 10-13-2008, 03:30 AM
yadster101 yadster101 is offline
Member
 
Join Date: Oct 2008
Posts: 2
yadster101 is on a distinguished road
New to java just wondering if you guys could tell me if i did this problem correct?
So the question is:

curHour and curMin represent the current time, and depHour, depMin
represent the departure time of a bus. Suppose all these variables are
initialized with some values; both times are between 1 p.m. and 11 p.m of the
same day. Fill in the blanks in the following statements that display the
remaining waiting time in hours and minutes:
int ____________ =
___________________________________ ;
System.out.println( ______________________________ +
" hours and " + ______________________________ +
" minutes.");


My answer is:
int Waiting_Time= (depHour + depMin) - (curHour + curMin);
System.out.println("Waiting_Time=" + "hours and" + ___________+ "minutes.");





Im not sure how i would get the minutes here without declaring them before?
Reply With Quote
Sponsored Links