File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes 2 questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "2 questions" Watch "2 questions" New topic
Author

2 questions

Daniel Lucas
Ranch Hand

Joined: Apr 24, 2006
Posts: 48
Alright I'm doing two AP test questions, and they both use the same code segment. Here it is(my analysis is below):


My analysis for question 8:

This is just a mathematical equation that's missing. First thing I notice is it needs to declare what both hours and minutes are, so it needs to be C or D. The only difference between C and D is C uses division whereas D uses modulus. Using modulus would be incorrect because say you had 3 hours + 90 minutes % 60, you would get 3 + 30, which is incorrect. So the answer must be C. *checks answer* yep, it's C.

My analysis for question 9:

Again I need to figure out which answer choice can be used to replace the missing expression to make it work as intended. In this case I'm missing the expression within the for statement. The intention is to compute the total of all the times stored in timeCards. So let's look at the answer choices:

A. This has no mathematical expression to compute the total.
B. This does not specify the format for the total.
C. C and D look like what we're trying to get, but it is necessary since the user is not inputting the hours and minutes to get them.
D. This answer choice gets the hours and minutes, making it the best answer choice IMO.
E. This does not even show a total, and is similar to D.

So I'm going to go with D. Am I right? *checks answer* Yep, it's D. Dunno if my reasoning is correct though
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 questions
 
Similar Threads
where is the bug?
<identifier> expected error
how to compute time?
Help me Debug the Code
problem with date