CS 1401, Quiz #4

Date: Monday, September 26, 2005
Name (please type legibly, ideally in block letters): ______________________________________________________________________

1. Write down a method that computes the tangent tan(x) as the ratio of sin(x) and cos(x). This method should have the following header:

public static double tangent(double x){





2. To attract more students, UTEP decided to officially change the name to The Great University. Because of this change, we must change the official letters. Describe the code that, given a string letter in which the word "UTEP" appears exactly once, replaces the word "UTEP" in this string with the sequence "The Great University". For example, the string
UTEP won the football game.
should be replaced with a string
The Great University won the football game.
Hints: The length of a string s can be found as s.length(); a substring can be found as s.substring(first_in,first_out).


















3. What is a Boolean variable? What values can it take? Why do we need Boolean variables?