• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

More assignments

 
Octavia Mondesir
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 12101
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic