//******************************************************************************
//
// CS 240C : Spring 2003 Ohio University Travis Dillon
// Project 3 : Animal Homes
// file : groundhog.cc
// started : 05-07-03
//
//******************************************************************************
#include "groundhog.h"
Groundhog::Groundhog(int xbox, int cost, int di, int len)
{ //this c-tor is used when reading data from the file
//the Groundhog object is instantiated with the new call
id = 4;
num_xbox = xbox;
price = cost;
diam = di;
length = len;
}
void Groundhog::input()
{ //user inputs all the attributes for the bat cave here
cout << "\nLet's make you a nice groundhog hole."
<< "\nWhat diameter does the whole need to be in inches? ";
cin >> diam;
cout << "How long of a tunnel in feet do you need? ";
cin >> length;
cout << "How many xbox's do you need? ";
cin >> num_xbox;
price = set_price(num_xbox, diam, length);
cout << "The total price will be $" << price;
}
void Groundhog::output()
{ //output when user wants to see all the homes ordered
cout << "\nGroundhog hole"
<< "\nhole diameter = " << diam
<< "\nhole length = " << length
<< "\nnumber of xbox's = " << num_xbox
<< "\ntotal price = $" << price
<< endl;
}
void Groundhog::print(ofstream& fout)
{ //output member variables to output file to be read in on next start up
fout << num_xbox << endl
<< price << endl
<< diam << endl
<< length << endl;
}
int Groundhog::set_price(int xbox, int di, int len)
{ //the actuall price of the home
return(xbox*225 + di*144*len);
}