Assignment 2

Solution

Important dates

Assigned28 Jan 2017 @ 00:30h
Due3 Feb 2017 @ 23:59h

Description

Implement functions using a header file and constants.

In this week’s assignment, you will write two functions to perform calculations related to the ideal gas law:

$$ PV = nRT $$

where $P$ is pressure in Pascals, $V$ is volume in $m^3$, $n$ is the number of mols of a gas, $R$ is the ideal gas constant ($J/\mathrm{mol} \cdot K$) and $T$ is temperature in Kelvin. You should pay close attention to units: some of the units associated with these functions may be different from those used by the ideal gas law.

This week, I will provide you with a C++ header file containing function declarations and I will expect you to provide the corresponding C++ source file with function definitions. Your source file should #include "assign2.h" and not modify it: I will be testing your code using the pristine version of this file. You should only submit your source (i.e., .cpp) file.

The C++ header file is given below: