There are n people in a room, where n is an integer greater than or equal to 2. Each person shakes hands once with every other person. What is the total number of handshakes in the room? Write a recursive method to solve this problem with the following header:

public static int handshake(int n)
where handshake(n) returns the total number of handshakes for n people in the room. To get you started, if there are only one or two people in the room, then:
handshake(1) = 0
handshake(2) = 1

This is a short and relatively straightforward recursive problem.

See the code in Handshake.java.

Computer Science & Information Technology

You might also like to view...

Static class variables:

a. are final. b. are public. c. are private. d. are shared by all objects of a class.

Computer Science & Information Technology

The name in an element's closing tag must match the name in the opening tag.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology