Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- carpenter.h
- #include "wall.h"
- class Carpenter {
- public:
- int CalcShelves(const Wall& wall) const;
- };
- ***************************************************************************************************************************************
- #include "carpenter.h"
- #include "square_calculation.h"
- #include <iostream>
- int Carpenter::CalcShelves(const Wall& wall) const
- {
- int x = CalcSquare(wall.GetHeight(), wall.GetWidth());
- return x / 2;
- }
- ***************************************************************************************************************************************
- square_calculation.cpp
- #include "square_calculation.h"
- double CalcSquare(double width, double height) {
- return width * height;
- }
- ***************************************************************************************************************************************
- square_calculation.h
- double CalcSquare(double width, double height);
- ***************************************************************************************************************************************
- wall.cpp
- #include "wall.h"
- Wall::Wall(double width, double height)
- : width_(width), height_(height), color_(Color::WHITE)
- {
- }
- double Wall::GetHeight() const {
- return height_;
- }
- double Wall::GetWidth() const {
- return width_;
- }
- void Wall::SetColor(Color color) {
- color_ = color;
- }
- Wall::Color Wall::GetColor() const {
- return color_;
- }
- ***************************************************************************************************************************************
- wall.h
- class Wall {
- public:
- enum class Color {
- BLUE,
- GREEN,
- RED,
- WHITE,
- YELLOW
- };
- Wall(double width, double height);
- double GetHeight() const;
- double GetWidth() const;
- void SetColor(Color color);
- Color GetColor() const;
- private:
- double width_;
- double height_;
- Color color_;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement