Classes

Substance Melting Point Boiling Point
Zinc (Zn) 787.15°F 1665°F
Barium (Ba) 1341°F 3353°F
Mercury (Hg) -37.89°F 674.11°F
Uranium (U) 2070°F 7468°F


Design a class that stores a temperature in a temperature member variable and has the appropriate accessor and mutator functions.

In addition to appropriate constructors, the class should have the following member functions for each of the elements:

• isZincMelting. This function should return the bool value true if the temperature stored in the temperature field is at or above the melting point and below the boiling point of zinc. Otherwise, the function should return false.

• isZincBoiling. This function should return the bool value true if the temperature stored in the temperature field is at or above the boiling point of zinc. Otherwise, the function should return false.

• Similarly you should have isBariumMelting, isBariumBoiling

• Similarly you should have isMercuryMelting, isMercuryBoiling

• Similarly you should have isUraniumMelting, isUraniumBoiling

Write a program that demonstrates the class.

The program should ask the user to enter a temperature, and then display a list of the substances that will melt at that temperature and those that will boil at that temperature.

For example, if the temperature is 1764 the class should report:

Zinc boils, Barium melts, Mercury boils and Uranium is solid


Last edited on
Topic archived. No new replies allowed.