id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > feb5_2016_APSLHL_populateArray
prev  |  next  |  chance

Write a method that "populates" an array of integers from 'first' to 'last' going up by 1 each time. For example, if you pass in 5 for 'first' and 7 for 'last' the method should return the array {5, 6, 7}. If 'first' and 'last' are the same number you return an array with just that number in it. If 'last' is less than 'first' return an empty array. Look at the test data for examples.


feb5_2016_APSLHL_populateArray(4, 6) → [4, 5, 6]
feb5_2016_APSLHL_populateArray(7, 14) → [7, 8, 9, 10, 11, 12, 13, 14]
feb5_2016_APSLHL_populateArray(1, 5) → [1, 2, 3, 4, 5]

...Save, Compile, Run (ctrl-enter)

public int[] feb5_2016_APSLHL_populateArray(int first, int last) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy