//******************************************************************************
//
// CS 240C : Spring 2003 Ohio University Travis Dillon
// Project 3 : Animal Homes
// file : bat.cc
// started : 05-07-03
//
//******************************************************************************
#include "bat.h"
Bat::Bat(int comp, int tv, int cost, int feet)
{ //this c-tor is used when reading data from the file
//the Bat object is instantiated with the new call
id = 1;
num_comp = comp;
num_tv = tv;
price = cost;
sq_feet = feet;
}
void Bat::input()
{ //user inputs all the attributes for the bat cave here
cout << "\nLet's make you a nice bat cave."
<< "\nHow many square feet would you like the cave to be? ";
cin >> sq_feet;
cout << "How many televisions do you need? ";
cin >> num_tv;
cout << "How many computers do you need? ";
cin >> num_comp;
price = set_price(num_tv, num_comp, sq_feet);
cout << "The total price will be $" << price;
}
void Bat::output()
{ //output when user wants to see all the homes ordered
cout << "\nBat cave"
<< "\nsquare footage = " << sq_feet
<< "\nnumber of televisions = " << num_tv
<< "\nnumber of computers = " << num_comp
<< "\ntotal price = $" << price
<< endl;
}
void Bat::print(ofstream& fout)
{ //output member variables to output file to be read in on next start up
fout << num_comp << endl
<< num_tv << endl
<< price << endl
<< sq_feet << endl;
}
int Bat::set_price(int tv, int comp, int feet)
{ //the actuall price of the home
return(179*tv + 1500*comp + 10*feet);
}