{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CHAPTER 11

# CHAPTER 11 - Java Software Solutions 4e Chapter 11...

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

Java Software Solutions, 4e Lewis/Loftus Chapter 11 Chapter 11 Exercise Solutions 11.1. Write a recursive definition of a valid Java identifier (see Chapter 1). 11.2. A valid Java Identifier is a Java Letter followed by zero or more Java Identifier Substrings . A Java Identifier Substring consists of zero or more valid Java Letters or zero or more Java Digits . A Java Letter is any of the 26 English alphabetic characters in both uppercase and lowercase, the \$ and the _ (underscore) characters, as well as alphabetic characters from other languages. A Java Digit includes the digits 0 through 9. 11.3. Write a recursive definition of x y (x raised to the power y), where x and y are integers and y > 0. 11.4. If y = 1, then x y = 1. otherwise x y = x * x (y-1) . 11.5. Write a recursive definition of i * j (integer multiplication), where i > 0. Define the multiplication process in terms of integer addition. For example, 4 * 7 is equal to 7 added to itself 4 times. 11.6. If i = 1, then i * j = j otherwise i * j = j + (i-1) * j where “*” refers to recursive multiplication as defined here and would be provided by a method such as “recursiveMult (i,j)”. To avoid confusing “*” with conventional multiplication, the definition could be rewritten as If i = 1, then recursiveMult (i,j) = j otherwise, recursiveMult (i,j) = j + recursiveMult (i, j-1)

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

View Full Document
Java Software Solutions, 4e Lewis/Loftus Chapter 11 11.7. Write a recursive definition of the Fibonacci numbers. The Fibonacci numbers are a sequence of integers, each of which is the sum of the previous two numbers. The first two numbers in the sequence are 0 and 1.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern