SOURCE FILE: 180_floorSpace01.cpp
/*
Program to display the floor space for a room
Initial design
*/
#include <iostream>
using namespace std ;
/* ================================== */
/* ================================== */
int main(void)
{
/*
Step One: Print Directions for the user
Step Two: Get the dimensions of the floor from the user
Step Three: IF either dimension is not positive
print an error message
OTHERWISE Compute FloorSpace as product of the
dimensions, and print the answer out
for the user to see
Notice that we expressed the solution to the problem as a few
major steps. The bigger the problem to be solved is, the more
important it is to start the design of the program by looking at
the "big picture". For example, how do we begin to write a
program that flies an airplane? Maybe think of it this way: 1)
take off, 2) fly close to destination, and 3) land. The idea is
to express everything you have to do in the proper order, so that
you can complete the algorithm if you expand those major steps
properly.
Notes on the solution method:
* Utilize a separate function to print the directions -
(One reason I might do this is because I want another
programmer to write that piece of the code. If the programmer
writes it as a function it should be easy to "plug it in" to
my program.)
* Make a function that gets one dimension and use it twice to get
the dimensions of the floor.
(This way, I avoid writing redundant code. The less code I
have to write, the faster I finish, and the fewer chances I
have to make a mistake.)
* Use a function to calculate the floor space
(In case I want to change or add something to the formula,
separating it out as a function may make it easier to find and
modify.)
* Do the rest with explicit code in main
*/
return 0;
}