This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes More assignments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "More assignments" Watch "More assignments" New topic

More assignments

Octavia Mondesir

Joined: Apr 03, 2008
Posts: 2
Could anyone provide any assistance on the following two assignments. Your help would be appreciated.

# 1

Given an int array length 2, return true if it contains a 2 or a 3.

has23({2, 5}) → true
has23({4, 3}) → true
has23({4, 5}) → false


Return the number of even ints in the given array. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.

countEvens({2, 1, 2, 3, 4}) → 3
countEvens({2, 2, 2}) → 3
countEvens({1, 3, 5}) → 0
fred rosenberger
lowercase baba

Joined: Oct 02, 2003
Posts: 11257

we're happy to HELP you do your homework. We won't, however, do it for you.

Please show us what you've tried, tell us what works or what doesn't, and specifically where you are stuck.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
jQuery in Action, 2nd edition
subject: More assignments