void Circle::resizeCircle(double r)
{
radius = r;
return;
}
/************************************************************************/
c2.printCircle();
cout << endl;
c1.moveCircle(p);
cout << “New c1: “;
c3.resizeCircle(10);
cout << “New c3: “;
c3.printCircle();
cout << endl;
Point center=c2.getCenterPoint();
cout << “c2 centerpoint: (” << center.getX() << ‘,’
<< center.getY() << “)” << endl;
cout << “c2 radius: ” << c2.getRadius() << endl;
Date();
Date(int, int, int);
void input_date(ifstream& fin);
void print_date(ofstream& fout);
void print_date_monthname(ofstream& fout);
year = 2000;
}
Date::Date(int m, int d, int y)
{
month = m;
day = d;
year = y;
}
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
fout << “December “;
};//end switch
fout << day << “, ” << year;
}
/************************************************************************/
/************************************************************************/
/* Date class Driver (chapter7_42.cpp) */
}
ofstream output;
exit(1);
}
tomorrow.input_date(input);
today.print_date(output);
output << endl;
today.print_date_monthname(output);
class Time
{
public:
//constructors
Time();
Time(int, int, int);
Time :: Time()
{
hour=0; min=0; sec = 0;
}
Time :: Time(int h, int m, int s)
{
hour = h;
min = m;
strcpy(ampm,”PM”);
if(hour12 > 12)
hour12 = hour12-12; //adjust hour to 12 hour time
if(hour12 == 0) hour12 = 12;
//print hour
hold.min = min;
hold.sec = sec;
if(hold.sec < t2.sec) //must borrow from minutes
{
hold.sec +=60;
hold.min–;
}
/* This is a sample driver program. */
#include <iostream>
#include <fstream>
#include “Time.h”
int main()
{
exit(1);
}
tomorrow.input_time(input);
today.print_12hour_time();
output << endl;
/******************************************************/
Tsunami Warning Systems
/*—————————————————-*/
/* Program chapter7_44.cpp */
/* This program inputs wave height and length data */
/* from an input file and calculates the average wave */
/* steepness. */
int main()
{
//Declare and initialize objects
double waveHeight, waveLength;
vector<double> steepness;
}
//Read header from input file
getline(fin,header);
//Read first lines of input
cout << “Average wave steepness is ” << avg << endl;
int count(0);
for(int i=0; i<steepness.size(); ++i)
{
if( steepness[i] > avg) ++count;
}
cout << count << ” waves (” << (count*100.0)/steepness.size()
<< “%) exceeded the average steepness” << endl;
/* This program generates a report of wave steepness */
/* and issues a warning message when steepnes exceeds */
/* a 1/7 ratio. */
#include<iostream> //Required for cin, cout, cerr.
#include<fstream> //Required for ifstream.
vector<double> steepness;
double wH, wL, hold;
int year, month, day, hour, minute;
string filename, header;
ifstream fin;
<< ” Goodbye.” << endl;
exit(1);
}
//Read header from input file
getline(fin,header);
//Echo header
cout << header << endl;
<< ” is unstable” << endl;
++i; //increment counter for output
//Read next line of input
fin >> year >> month >> day >> hour
>> minute >> wH >> wL;
}//end while
steepness[i] = steepness[maxI];
steepness[maxI] = hold;
//waveHeight
hold = waveHeight[i];
waveHeight[i] = waveHeight[maxI];
}
Vegetation Maps
/* Program chapter7_46 */
/* VegetationSample.h */
/* This is the implementation of VegetationSample */
/* Replacing the plantCounts array with a vector */
/* Created by Jeanine Ingber on 7/23/15. */
class VegetationSample
{
private:
//data members
double latitude,longitude,elevation;
vector<int> plantCounts;
public:
//Methods to support public interface
};
/***************************************************************/
#endif /* defined(__Chapter7_9VegetationMaps__VegetationSample__) */
// VegetationSample.cpp
// Chapter7-9VegetationMaps
//
//
#include “VegetationSample.h”
{
cout << “in VS:inputSampleData..” << endl;
in >> latitude >> longitude >> elevation;
cout << “input is ” << latitude << ‘ ‘ << longitude << ‘ ‘
<< elevation << endl;
for(int i=0; i<plantCounts.size(); ++i){
{
//Find below average samples
double count, average;
bool first;
out << “Below average plant samples occurred
<< in the following geographical locations:” << endl<<endl;
for(int i=0;i<numSamples;++i){
first=true;
out << endl;
VegetationSample::VegetationSample(int size)
{
//Parameterized constructor
//initial all plant counts
for(int i=0; i<size; ++i)