SOURCE FILE: floorSpace02.cpp
/*
Program to display the floor space for a room
Fleshed-out design
+ function calls added to the main function,
as the designer wishes them to be
+ in-line code added that completes the
executable statements needed in main
Still missing:
+ Declarations of variables
+ Declarations (prototypes) of functions
+ Definitions of functions
So far, the designer has only entered calls to non-existent functions.
*/
#include <iostream>
using namespace std ;
/* ================================== */
/* ================================== */
int main(void)
{
/* Step One: Print Directions for the user */
directions() ;
/* Step Two: Get the dimensions of the floor from the user */
dim1 = GetDim();
dim2 = GetDim();
/* Step Three: IF either dimension is not positive
print an error message
ELSE Compute FloorSpace as product and
print the answer out for the user to see
*/
if ( (dim1 <= 0) || (dim2 <= 0) ) // invalid data
{
cout << "\nSorry, only positive dimensions are allowed.\n";
cout << "Please reexecute the program.\n\n";
}
else // valid data
{
FloorSpace = area(dim1, dim2);
cout << "\nThe floor space is " << FloorSpace << " square feet.\n\n";
}
/*
Notes on solution method:
* Use function to print directions
* Make a function that gets one dimension and use
it twice to get the dimensions of the floor
* Use a function to calculate the floor space
* Do the rest with explicit code in main
*/
return 0;
}