quiz13 - Name: _ Dave's 15-100 Section: M N O P April 29,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Name: ____________________ Section: M N O P Dave's 15-100 April 29, 2009 Quiz 13 1. Implement the insertInFront method, which should insert the given int into the first position of the given array by shifting all other elements one position toward the end of the array, and returning the value removed from the end of the array. This is illustrated by the following example calls to insertInFront(newVal, array) : newVal array before call array after call value returned 3 {5, 1, 2, 7, 9} {3, 5, 1, 2, 7} 9 8 {2, 5, 7, 1} {8, 2, 5, 7} 1 6 {2} {6} 2 7 {9, 6} {7, 9} 6 You may assume array.length > 0. public static int insertInFront(int newVal, int[] array) {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 The Course class represents a single academic course with a name (such as "Intro to Programming" ) and a number of units (such as 10 ). The methods for the Course class are listed below. Course class String getName () // returns name of this course int getNumUnits () // returns number of units for this course The Catalog class represents the collection of courses offered by a school. References
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

quiz13 - Name: _ Dave's 15-100 Section: M N O P April 29,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online