Download Exam1 review

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Elementary mathematics wikipedia , lookup

Transcript
Exam1 Review problems
1/1
1. Write a complete program that takes temperature values in Fahrenheit and converts to degrees
Celsius, degrees Kelvin, and degrees Rankine. The Fahrenheit values should vary from 30F
to 210 in steps of 30. The program should have no user input. The output values need to be
well labeled with words and units.
(a) Kelvin = Celsius + 273.15
(b) Rankine = Fahrenheit + 459.67
(c) Celsius = 5/9(Fahrenheit – 32)
2. A company produces digital watches and sells them for $15 each. However, it gives a discount
for multiple orders as follows: 2 to 4 watches = 5%, 5 to 9 watches = 10%, 10 to 29 watches =
15%, 30 to 99 watches = 20% and 100 or more watches = 25%.
You are to write a complete program that prompts the user to input the number of watches
desired, and then calculates the discount (if any) and the final cost. Output (with good labels)
the number of watches, the gross (non-discounted) cost and the net cost (final cost).
3. A famous mathematical sequence is the Fibonacci series given by:
1, 1, 2, 3, 5, 8, 13, 21, 34, . . .
After the first two numbers all additional terms in the series are calculated as the sum of the
previous two numbers.
Write a program to calculate the first n terms in the series. The program should prompt the
user to enter n, then output each term in the series in a separate message box. Each message
box should indicate the term and what number term it is in the series (term number one would
be 1, term number two would be 1, term number three would be 2, etc.).