#include <iostream>
#include <iomanip>
#include <cmath>
using namespace Std;
Your code'll is here
Class Land
{
Public
Land (): Price_ (0) {}
Explicit Land (int. price);
Calculate how much Feng Gor can earn from the land
Virtual Double Calmoney () = 0;
Protected
Price of unit area
int price_;
};
Class Square:public Land
{
Public
Square (double len, int price);
Double Calmoney ();
Private
Length of side of a square
Double Len_;
};
Class Circle:public Land
{
Public
Circle (double radius, int price);
Double Calmoney ();
Private
Length of radius of a circle
Double Radius_;
};
Circle::circle (double radius, int price) {
Radius_ = radius;
Price_ = Price;
}
Double Circle::calmoney () {
Return ACOs ( -1) *price_ * radius_ * RADIUS_;
}
Square::square (double len, int price) {
Len_ = Len;
Price_ = Price;
}
Double Square::calmoney () {
return Len_ * Len_ * PRICE_;
}
void Accountant::D evelopestate (land* land) {
Money_ + = Land->calmoney ();
}
Double Accountant::checkmoney () {
return money_;
}
Class Accountant
{
Public
Accountant (): Money_ (0) {}
Develop a land, earn the value of the land
void Developestate (land* land);
Return the value of Money_
Double Checkmoney ();
Private
Double Money_;
};
int main (int argc, const char *argv[])
{
Accountant py;
Circle *a = New Circle (100, 10000);
Square *b = new Square (100, 50000);
Py. Developestate (a);
cout << Setprecision (Ten) << py. Checkmoney () << Endl;
Py. Developestate (b);
cout << Setprecision (Ten) << py. Checkmoney () << Endl;
return 0;
}
1000.1 Letters and Words homework 12