CS 1401, Exam #1

Date: Friday, September 15, 2006, 11:30 am
Name (please type legibly, ideally in block letters): ______________________________________________________________________

1. History of computing:
(a) Describe the contribution of ancient Egyptians to computing.
(b) How did the invention of zero make computing easier?
(c) For extra credit: describe one more event from the history of computing.

2. As you may know, today, El Grito is celebrated on campus - just as we are working on this test. To make the participants more comfortable, the University decided to bring benches for people to sit. Suppose that you know how many people plan to come, you know the percentage of people who prefer to sit, and you know how many people can sit on a single bench. Describe, step-by-step, an algorithm that would compute the necessary number of benches. For example, if we expect 1,200 folks and we know that 40% prefer to sit, then we need siting places to accomodate 1,200 x (40/100)= 480 people. If each bench sits 10 people, this means that we need 480/10=48 benches.

3. For each of the following sequences of symbols, describe which can be valid Java identifiers and which cannot be; if you believe they cannot be, briefly explain why (e.g., "is a reserved word" or "does not start with a letter"):

4-5. Write a main method that asks a user for the number of people planning to attend, for the percentage of those who want to sit, and for the number of people that can sit on one bench, and then computes and prints the statement:
 For El Grito, we need (amount) benches. 
For example, if your estimates number is 48 benches, the computer should print:
 For El Grito, we need 48 benches. 

Reminder: to read from the screen, you can define the input object as follows:

Scanner key = new Scanner(System.in);
the header of the main method is:
public static void main(String[] args){

6. After a hard-working week, you deserve some rest. Help yourself relax by writing down a line of code that, given a string yourName (that contains your name), places a wish for you to have a nice weekend into a variable wish. For example, if your name is Beatriz, the contents of the string wish should be "Dear Beatriz, have a nice weekend."