This is a JAVA question Consider the following declaration that appears in a cla
ID: 3836474 • Letter: T
Question
This is a JAVA question
Consider the following declaration that appears in a class other than TimeRecord
TimeRecod[] timeCard = new TimeRecod[100];
Assume that timeCards has been initialized with TimeRecord objects. Consider the following code segment that is intended to compute the total of all the time stored in timeCards.
TimeRecord total = new TimeRecord(0, 0);
for (int k = 0; k<timeCards.length; k++)
{ /* missing expression*/;}
Which of the following can be used to replace missing expression so that the code segment will work as intended?
A) timeCards[k].advance()
B) total +=timeCards[k].advance()
C) total.advance(timeCards[k].hours, timeCards[k].minutes)
D) total.advance(timeCards[k].getHours(), timeCards[k].getMinutes())
Explanation / Answer
Answer:D) total.advance(timeCards[k].getHours(), timeCards[k].getMinutes())
Option is D is the right way of compute the total of all the time stored in timeCards.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.