testfourPractice

testfourPractice - Practice Questions for Test 4 Fall 2007...

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

View Full Document Right Arrow Icon
Practice Questions for Test 4: Fall 2007 CSC121: Stewart 1.Write a method, public double checkMatches(int[] classOne, int[] classTwo) . You can assume that all entries of classOne and classTwo are being used. checkMatches() returns the fraction of cells in parallel positions of the two arrays that contain the same values. For example if classOne contains fifty values of 1 followed by fifty values of 2, and classTwo contains fifty values of 1 followed by fifty values of 4, then checkMatches would return 0.5, because there were 50 out of 100 matches. 2. Write a method, public void isOrdered(IntType[] theList) The class IntType has one instance variable of type int. The class has an accessor method, getTheInt() , that returns the value of the int instance variable. The method, isOrdered() , should display "in order", if the values in theList are in ascending order; and "not in order", otherwise. For example, if theList contains 1, 4, 5, 6, 6, 9, then the method should display "in order". However, if
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/17/2008 for the course PHYS 120 taught by Professor Decarlo during the Spring '08 term at DePauw.

Page1 / 2

testfourPractice - Practice Questions for Test 4 Fall 2007...

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

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