lab7_001 - 15-121 FALL 2009 [CORTINA]LAB 7 - due Friday,...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: 15-121 FALL 2009 [CORTINA]LAB 7 - due Friday, Oct 30 by 9PMIn this lab, you will implement several recursive methods. EXERCISESDownload the project Lab7.zip. This project has three classes, one for each exercise below. Complete the required methods below. 1. Write a recursive method sumthat has one parameter, a positive integer n, and returns the sum of the positive integers from 1 to n. 2. Write a recursive method countthat has two parameters, a string and a character, and it returns the number of times the character appears in the string. You may only use the following String methods as necessary: charAt, substring, equals, length. HINT: The number of times a character appears in a string is 1 (if the character matches the string's first character) + the number of times the character appears in the rest of the string. 3.[HARDER]Write a recursive method makePermutationsthat has a string as its parameter and returns an array list containing all strings that are permutations of this string. A permutation is a string returns an array list containing all strings that are permutations of this string....
View Full Document

Page1 / 2

lab7_001 - 15-121 FALL 2009 [CORTINA]LAB 7 - due Friday,...

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