## CS 1401, Exam #1, TR version

Date: Thursday, February 7, 2008
Name (please type legibly, ideally in block letters): ______________________________________________________________________

As you probably know, we are currently in the middle of the 2007-2008 International Polar Year (IPY). Recently, a group of UTEP students returned from Antarctica where they actively participated in the IPY-related polar research.

1. Navigation in Antarctica requires complex geometric computations. Let us recall how these computations started.
(a) In the ancient world, in what country did the need for geometric computations appear and why?
(b) In more modern times, what computational device was motivated by the navigational and other needs of the Navy?
(c) For extra credit: describe one more event from the history of computing.

```

```
2. The student trip to Antarctica was covered by a special grant from the National Science Foundation (NSF). To work in Antarctica with its extremely cold climate, each student needs to be equipped with a special coat and special shoes. In addition, a special plane needs to be rented to bring students there. Describe, step-by-step, an algorithm that would allow to compute how much we need to ask NSF per student to cover the costs. As part of this algorithm, you should ask for the number of students, the cost of a plane rental, the price of a coat, and the price of special shoes. For example, if renting a plane costs \$100K, a coat costs \$4K, and shoes cost \$3K, then the overall cost for a group of 10 students is \$100K + 10 * (\$4K + \$3K) = \$170K. Thus, we should request \$170K / 10 = \$17K per student.
```

```
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"):
• Antarctica

• International Polar Year

• IPY2007-2008

• IPY2007_2008

• shoesCost\$3K

```

```
4-5. Write a main method that asks a user for the name of the university, the number of students, the cost of renting a plane, the price of a coat, and the price of shoes, and then computes and prints the following request:
```To: National Science Foundation,

Please supply (university name here) with the amount of \$(amount here)K
per student for (number here) students for a trip to Antarctica.
```
(Do not worry about formatting the amount.) For example, if UTEP asks for funding for a group of 10 students, renting a plane costs \$100K, a coat costs \$4K, and the shoes cost \$3K per student, the computer should print:
```To: National Science Foundation,

Please supply UTEP with the amount of \$17K
per student for 10 students for a trip to Antarctica.
```

Reminder: to read from the keyboard, you can define the reader as follows:

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

```

```
6. Students need a special boarding pass for going to Antarctica. To generate such passes, write down a line of code that, given a string name (that contains the name of the student), places the message
```This is a boarding pass for (name here) to travel to Antarctica
```
into a string boardingPass. For example, for your TA Corina Vela, boardingPass should be
```This is a boarding pass for Corina Vela to travel to Antarctica
```