Question: In c++ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // main.cpp // // driver for working with a few chemicals #include #include #include Chemical.h using namespace std; int main() { cout
In c++




----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// main.cpp
//
// driver for working with a few chemicals
#include
#include
#include "Chemical.h"
using namespace std;
int main()
{
cout
//TODO: create a Chemical for water here!
cout
// TODO: call the applyEnergyDifference function to apply 1000.0 joules of energy!
cout
cout
//TODO: create a Chemical for hydrogen chloride here!
cout
//TODO: call the applyEnergyDifference function to absorb 1000.0 joules of energy!
cout
}
We want to write a program that uses classes to implement the heating and cooling of substances. We need a formula first: This equation tells us that the energy expelled or absorbed (Q, joules) is equal to the specific heat capacity (c, joules/(Celsius grams)) times mass (grams) times the change in temperature (Celsius). We want to expand and rearrange the equation a bit to achieve the following formula: Here, T, and T,are the final and initialtemperatures of the substance. Given that for a speaifiecd substance, mass of that substance, and initial temperature, we can compute the new temperature by applying some energy difference (Q). Thus, we want to create a class to represent some sample. Our class should contain information to represent T, c, and m. We will have functions for the constructor and applying some energy differential to the chemical
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
