Free Essay

?????????????????????

In:

Submitted By Dobielover
Words 262
Pages 2
Programming Assignments
Dave Nielsen

1. Temperature Conversion
Fahrenheit temperatures are converted to Celsius (centigrade) by the following formula:

Celsius = x (Fahrenheit - 32)

Write a program to convert Fahrenheit temperatures to their equivalent Celsius temperatures using a user-terminated loop. Input the Fahrenheit temperature and display both the Fahrenheit and Celsius temperatures. Use the following temperatures to test the program: 78.4 -50 98.6 32 212 0

2. Annual Depreciation
The annual depreciation of an asset by the straight-line method is calculated by the following formula:

Depreciation =

Write a program that accepts the cost, salvage value, and service life, calculates the depreciation, and prints all input values along with the calculated result. Set up a user-terminated loop.

3. Grains of Rice
A company agrees to pay one of its employees in grains of rice instead of money. The employee receives one grain on the first day, two grains on the second day, four grains on the third day, eight grains on the fourth day, and so forth. In other words, each succeeding day the employee receives twice as many grains of rice as the previous day. The employee works for the company for 18 days. Write a program to determine the number of grains of rice that the employee receives on each day he or she works. Also, accumulate the total rice earnings. There is no input for this program. Output should consist of (at least) 18 lines, each with the day number, the number of grains received that day, and the accumulated number of grains received to date.

Similar Documents