Examlex

Solved

The Following Example Shows How a Programmer Might Avoid a Division

question 9

Essay

The following example shows how a programmer might avoid a division by zero error by explicitly checking for the error condition:
if(gallonsOfGas != 0)
mpg = milesDriven /gallonsOfGas;
else
mpg = 0;
Another possible way to deal with this is to use exception handling mechanisms.What factors help the programmer decide which of these methods to use?


Definitions:

Intermolecular Force

The forces of attraction or repulsion which act between neighboring particles (atoms, molecules, or ions).

Dispersion Forces

Weak forces resulting from temporary polarization of molecules due to the movement of electrons, also known as London dispersion forces.

Van Der Waals

Weak forces of attraction between molecules, named after Dutch physicist Johannes Diderik van der Waals, significant in the properties of gases and liquids.

Dipole-Dipole Forces

Intermolecular forces between two polar molecules due to the positive and negative poles attracting each other.

Related Questions