Chapter 61 Programming Exercises


Exercise 1 — Temperature Conversion

Modify the temperature conversion program so that it converts Celsius to Fahrenheit. Use the formula:

fahr = celsius*9/5 + 32

Click here to go back to the main menu.

Click here view the solution for this question.


Exercise 2 — Two Way Conversion

Add two buttons to the temperature conversion program. Clicking one button converts Fahrenheit to Celsius, clicking the other converts Celsius to Fahrenheit. Set to "noneditable" whichever text field is to contain the result of the conversion. Add a "clear" button that clears the text in both text fields.

Click here to go back to the main menu.

Click here view the solution for this question.


Exercise 3 — User-friendly Fat Calculator

Modify the calories from fat calculator so that it does not crash when the user enters text that cannot be converted to a double. You might have to look ahead to chapters 80 and 81 for this, or look at the modification done with the temperature converter and try to do something similar.

Click here to go back to the main menu.

Click here view the solution for this question.

Click here view the improved solution for this question.