/* File: colorcube.C

   Implementation of the ColorCube derived class
*/

#include <stdio.h>
#include <stdlib.h>

#include "colorcube.h"

/* default constructor
   Note: default constructor for Cube is called already.
*/
ColorCube::ColorCube() { 
   printf("ColorCube debug: l=%f h=%f w=%f\n", length, height, width) ;
   debug() ;
   ccolor = red ;
}


/* create a cube with equal sides 
   Note: default constructor for Cube is called already.
*/
ColorCube::ColorCube(float side, color c) {
   printf("ColorCube debug: l=%f h=%f w=%f\n", length, height, width) ;
   debug() ;
   length = height = width = side ;
   if (c >= red && c <= blue) { 
      ccolor = c ;
   } else { /* bad color given */
      ccolor = red ;
   }
}


/* report vital stats for color cubes */
void ColorCube::identify() {
   char *colorstr ;

   switch(ccolor) {
      case red   : colorstr = "red" ;   break ;
      case white : colorstr = "white" ; break ;
      case blue  : colorstr = "blue" ;  break ;
   }
   
   printf("I'm a %s cube. Each side has length=%f\n", colorstr, length) ;
}
