## CS 1401, Exam #1

**Date:** Friday, September 16, 2005

**Name** (please type legibly, ideally in block letters):
______________________________________________________________________

**UTEP ID #** (if you do not remember it, it is OK):
______________________________________________________________________
1. Briefly describe Turing's contribution to computing.
*For extra credit:* describe one more event form the history
of computing.

2. Suppose that the price for an old car is determined as follows:
if a car is more than 15 years old, it cannot be sold because it no
longer fits the emission standard; in short, the price is 0.
If the car is 5 to 15 years old,
its price is 30% of the original price, if the car is less than 5
years old, its price is 70% of the original price.
Describe, step-by-step, an algorithm that, given the car's original
price and age, returns the price of the old car.

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"):
- old_car

- old-car

- 70%

- carIs14YearsOld

- char

4. Write a *main* method that asks a user for the age and
the original price of the car, and then prints the statement:
This car is (age) years old. It was bought for (price).

For example, for a 14 year old car which costs $5,000:
This car is 14 years old. It was bought for $5,000.

*Reminder:*
to read strings, you can define the input object as follows:

BufferedReader carReader = **new** BufferedReader(**new** InputStreamReader(System.in));

the header of the *main* method is:
**public** **static** void main(String[] args) **throws** IOException{

5. Write down a piece of code that, given amount of money
*originalPrice*, computes 30% of this amount. Assume that the
original price is an integer. Trace
your code on the example when the original price was $5,000.