File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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: 11927

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
I agree. Here's the link:
subject: More assignments
It's not a secret anymore!