aspose file tools*
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "More assignments" Watch "More assignments" New topic
Author

More assignments

Octavia Mondesir
Greenhorn

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

#2

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
Bartender

Joined: Oct 02, 2003
Posts: 11479
    
  16

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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: More assignments