diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2396c1b --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use o IntelliSense para saber mais sobre os atributos possíveis. + // Focalizar para exibir as descrições dos atributos existentes. + // Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Iniciar", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/sistema", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Habilitar a reformatação automática para gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..22c9985 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,50 @@ +{ + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "cctype": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "unordered_map": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "new": "cpp", + "ostream": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "typeinfo": "cpp" + } +} \ No newline at end of file diff --git a/Apartamento.hpp b/Apartamento.hpp deleted file mode 100644 index 4dd5981..0000000 --- a/Apartamento.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef APARTAMENTO_HPP -#define APARTAMENTO_HPP - -#include "Imovel.hpp" -#include "Cliente.hpp" - -using namespace std; - -class Apartamento : public Imovel { - - public: - - double valor() { - - double v = AREA * VALORm2; - - return v; - - } - - double comissao() { - - double c = AREA * VALORm2; - - return c * 0.04; - - } - - void print() { - - std::cout << "[Apartamento]" << endl; - Imovel::print(); - std::cout << "Area: " << AREA << endl - << " Quartos: " << Q << endl - << " Banheiros: " << B << endl - << " Vagas: " << V << endl - << "Taxa de Comissão: " << 4 << "%" << endl - << "Valor Comissão: R$ " << fixed << setprecision(2) << C << endl - << "Valor de Venda: R$ " << fixed << setprecision(2) << Valor << endl; - } -}; - -#endif \ No newline at end of file diff --git a/Casa.hpp b/Casa.hpp deleted file mode 100644 index 88a51d6..0000000 --- a/Casa.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CASA_HPP -#define CASA_HPP - -#include "Imovel.hpp" -#include "Cliente.hpp" - -using namespace std; - -class Casa : public Imovel { - - public: - - double valor() { - - double v = AREA * VALORm2; - - return v; - - } - - double comissao() { - - double c = AREA * VALORm2; - - return c * 0.06; - - } - - void print() { - - std::cout << "[Casa]" << endl; - Imovel::print(); - std::cout << "Area: " << AREA << endl - << " Quartos: " << Q << endl - << " Banheiros: " << B << endl - << " Vagas: " << V << endl - << "Taxa de Comissão: " << 6 << "%" << endl - << "Valor Comissão: R$ " << fixed << setprecision(2) << C << endl - << "Valor de Venda: R$ " << fixed << setprecision(2) << Valor << endl; - - } - -}; - -#endif \ No newline at end of file diff --git a/Cliente.cpp b/Cliente.cpp deleted file mode 100644 index 14f64f0..0000000 --- a/Cliente.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include "Cliente.hpp" - -void Cliente::print(){ - - std::cout << " Nome: " << NOME << endl - << " Telefone: " << telefone << endl - << " Endereço: " << endereco << endl - << " Cidade: " << CIDADE << endl - << " Estado: " << UF << endl - << " CEP: " << cep << endl; - -} \ No newline at end of file diff --git a/Cliente.hpp b/Cliente.hpp deleted file mode 100644 index f32d122..0000000 --- a/Cliente.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef CLIENTE_HPP -#define CLIENTE_HPP - -#include -using namespace std; - -class Cliente { - public: - string NOME; - string endereco; - string CIDADE; - string UF; - string cep; - string telefone; - - void print(); -}; - -#endif \ No newline at end of file diff --git a/Cobertura.hpp b/Cobertura.hpp deleted file mode 100644 index e8c4281..0000000 --- a/Cobertura.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef COBERTURA_HPP -#define COBERTURA_HPP - -#include "Imovel.hpp" -#include "Cliente.hpp" -using namespace std; - -class Cobertura : public Imovel { - - public: - - double valor() { - - double v = AREA * VALORm2; - - return v; - - } - - double comissao() { - - double c = AREA * VALORm2; - - return c * 0.10; - - } - - void print() { - - std::cout << "[Cobertura]" << endl; - Imovel::print(); - std::cout << "Area: " << AREA << endl - << " Quartos: " << Q << endl - << " Banheiros: " << B << endl - << " Vagas: " << V << endl - << "Taxa de Comissão: " << 10 << "%" << endl - << "Valor Comissão: R$ " << fixed << setprecision(2) << C << endl - << "Valor de Venda: R$ " << fixed << setprecision(2) << Valor << endl; - } -}; - -#endif \ No newline at end of file diff --git a/Imovel.hpp b/Imovel.hpp deleted file mode 100644 index 6e91cfc..0000000 --- a/Imovel.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef IMOVEL_HPP -#define IMOVEL_HPP - -#include -#include -#include "Cliente.hpp" - -using namespace std; - -class Imovel { - public: - double AREA; - int Q; - int B; - int V; - double VALORm2; - double Valor; - double C; - Cliente vendedor; - string corretor; - - void print() { - cout << "[Vendedor]" << endl; - vendedor.print(); - cout << "[Corretor]" << endl; - cout << " " + corretor << endl; - } -}; - -#endif \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bc635ae --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +CC=g++ +CFLAGS=-std=c++11 -Wall -lm +TARGET=sistema + +BUILD_DIR = ./build +SRC_DIR = ./src +INCLUDE_DIR = ./include + +${TARGET}: ${BUILD_DIR}/Cliente.o ${BUILD_DIR}/Imovel.o ${BUILD_DIR}/main.o ${BUILD_DIR}/Cobertura.o ${BUILD_DIR}/Apartamento.o ${BUILD_DIR}/Casa.o + ${CC} ${CFLAGS} -o ${TARGET} ${BUILD_DIR}/*.o + +${BUILD_DIR}/Cobertura.o: ${INCLUDE_DIR}/Cobertura.hpp ${SRC_DIR}/entidades/Cobertura.cpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/entidades/Cobertura.cpp -o ${BUILD_DIR}/Cobertura.o + +${BUILD_DIR}/Cliente.o: ${INCLUDE_DIR}/Cliente.hpp ${SRC_DIR}/entidades/Cliente.cpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/entidades/Cliente.cpp -o ${BUILD_DIR}/Cliente.o + +${BUILD_DIR}/Imovel.o: ${INCLUDE_DIR}/Imovel.hpp ${SRC_DIR}/entidades/Imovel.cpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/entidades/Imovel.cpp -o ${BUILD_DIR}/Imovel.o + +${BUILD_DIR}/Casa.o: ${INCLUDE_DIR}/Casa.hpp ${SRC_DIR}/entidades/Casa.cpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/entidades/Casa.cpp -o ${BUILD_DIR}/Casa.o + +${BUILD_DIR}/Apartamento.o: ${INCLUDE_DIR}/Apartamento.hpp ${SRC_DIR}/entidades/Apartamento.cpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/entidades/Apartamento.cpp -o ${BUILD_DIR}/Apartamento.o + +$(BUILD_DIR)/main.o : $(SRC_DIR)/main.cpp $(INCLUDE_DIR)/Apartamento.hpp $(INCLUDE_DIR)/Casa.hpp $(INCLUDE_DIR)/Cliente.hpp $(INCLUDE_DIR)/Cobertura.hpp $(INCLUDE_DIR)/Imovel.hpp + ${CC} ${CFLAGS} -I ${INCLUDE_DIR}/ -c ${SRC_DIR}/main.cpp -o ${BUILD_DIR}/main.o + +# Rule for cleaning files generated during compilation. +# Call 'make clean' to use it +clean: + rm ${BUILD_DIR}/* diff --git a/build/Apartamento.o b/build/Apartamento.o new file mode 100644 index 0000000..f6b73dd Binary files /dev/null and b/build/Apartamento.o differ diff --git a/build/Casa.o b/build/Casa.o new file mode 100644 index 0000000..d6e3ace Binary files /dev/null and b/build/Casa.o differ diff --git a/build/Cliente.o b/build/Cliente.o new file mode 100644 index 0000000..e88c4da Binary files /dev/null and b/build/Cliente.o differ diff --git a/build/Cobertura.o b/build/Cobertura.o new file mode 100644 index 0000000..4dcd0b7 Binary files /dev/null and b/build/Cobertura.o differ diff --git a/build/Imovel.o b/build/Imovel.o new file mode 100644 index 0000000..399045e Binary files /dev/null and b/build/Imovel.o differ diff --git a/build/main.o b/build/main.o new file mode 100644 index 0000000..ac05436 Binary files /dev/null and b/build/main.o differ diff --git a/include/Apartamento.hpp b/include/Apartamento.hpp new file mode 100644 index 0000000..bcc713a --- /dev/null +++ b/include/Apartamento.hpp @@ -0,0 +1,19 @@ +#ifndef APARTAMENTO_HPP +#define APARTAMENTO_HPP + +#include "Imovel.hpp" +#include "Cliente.hpp" + +using namespace std; + +class Apartamento : public Imovel { + public: + Apartamento(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor); + double comissao() override; + + void print() override; + private: + static constexpr double comissao_taxa = 0.04; +}; + +#endif \ No newline at end of file diff --git a/include/Casa.hpp b/include/Casa.hpp new file mode 100644 index 0000000..a84aa41 --- /dev/null +++ b/include/Casa.hpp @@ -0,0 +1,17 @@ +#ifndef CASA_HPP +#define CASA_HPP + +#include "Imovel.hpp" +#include "Cliente.hpp" + +class Casa : public Imovel { + public: + Casa(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor); + double comissao() override; + + void print() override; + private: + static constexpr double comissao_taxa = 0.06; +}; + +#endif \ No newline at end of file diff --git a/include/Cliente.hpp b/include/Cliente.hpp new file mode 100644 index 0000000..328afbf --- /dev/null +++ b/include/Cliente.hpp @@ -0,0 +1,37 @@ +#ifndef CLIENTE_HPP +#define CLIENTE_HPP + +#include +using namespace std; + +class Cliente { + public: + Cliente(string nome, string endereco, string cidade, string uf, string cep, string telefone); + Cliente() {}; + + void print(); + + string get_nome(); + string get_endereco(); + string get_cidade(); + string get_uf(); + string get_cep(); + string get_telefone(); + + void set_nome(string nome); + void set_endereco(string endereco); + void set_cidade(string cidade); + void set_uf(string uf); + void set_cep(string cep); + void set_telefone(string telefone); + + private: + string _nome; + string _endereco; + string _cidade; + string _uf; + string _cep; + string _telefone; +}; + +#endif \ No newline at end of file diff --git a/include/Cobertura.hpp b/include/Cobertura.hpp new file mode 100644 index 0000000..5dc3ea6 --- /dev/null +++ b/include/Cobertura.hpp @@ -0,0 +1,18 @@ +#ifndef COBERTURA_HPP +#define COBERTURA_HPP + +#include "Imovel.hpp" +#include "Cliente.hpp" +using namespace std; + +class Cobertura : public Imovel { + public: + Cobertura(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor); + double comissao() override; + + void print() override; + private: + static constexpr double comissao_taxa = 0.1; +}; + +#endif \ No newline at end of file diff --git a/include/Imovel.hpp b/include/Imovel.hpp new file mode 100644 index 0000000..84c157f --- /dev/null +++ b/include/Imovel.hpp @@ -0,0 +1,29 @@ +#ifndef IMOVEL_HPP +#define IMOVEL_HPP + +#include +#include +#include "Cliente.hpp" + +class Imovel { + protected: + double _area; + int _quartos; + int _banheiros; + int _vagas; + double _valor_m2; + double _valor_venda; + double _valor_comissao; + Cliente _vendedor; + string _corretor; + + public: + Imovel(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor); + virtual void print(); + double valor(); // Função que retorna o preço do imóvel + virtual double comissao() = 0; // Função que retorna a comissão cobrada pela venda do imóvel + + double set_valor_venda(); +}; + +#endif \ No newline at end of file diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 2496147..0000000 --- a/main.cpp +++ /dev/null @@ -1,244 +0,0 @@ -#include -#include - -#include "Imovel.hpp" -#include "Casa.hpp" -#include "Cobertura.hpp" -#include "Apartamento.hpp" -#include "Cliente.hpp" - -int main() { - - Cliente cl1; - cl1.NOME = "Xayso Sovon Ziahaka"; - cl1.endereco = "Rua Xangrilá - Braúnas"; - cl1.CIDADE = "Belo Horizonte"; - cl1.UF = "MG"; - cl1.cep = "31365-570"; - cl1.telefone = "3196007958"; - - Cliente cl2; - cl2.NOME = "Minia Pasies Kituos"; - cl2.endereco = "Rua dos Jacobinos - Ouro Minas"; - cl2.CIDADE = "Belo Horizonte"; - cl2.UF = "MG"; - cl2.cep = "31870-290"; - cl2.telefone = "3197627067"; - - Cliente cl3; - cl3.NOME = "Vuocue Leiur Baonauza"; - cl3.endereco = "Rua Orminda de Almeida - Tupi B"; - cl3.CIDADE = "Belo Horizonte"; - cl3.UF = "MG"; - cl3.cep = "31842-630"; - cl3.telefone = "3195949327"; - - Cliente cl4; - cl4.NOME = "Zerer Huduy Fyogar"; - cl4.endereco = "Rua Taquaril - Jonas Veiga"; - cl4.CIDADE = "Belo Horizonte"; - cl4.UF = "MG"; - cl4.cep = "30285-422"; - cl4.telefone = "3198596327"; - - Cliente cl5; - cl5.NOME = "Ceziel Mioti Pler"; - cl5.endereco = "Rua João Gualberto Costa - Serrano"; - cl5.CIDADE = "Belo Horizonte"; - cl5.UF = "MG"; - cl5.cep = "30882-747"; - cl5.telefone = "3196274465"; - - Cliente cl6; - cl6.NOME = "Esxo Cilal Zyais"; - cl6.endereco = "Rua Américo Luiz Moreira - Jardim dos Comerciários (Venda Nova)"; - cl6.CIDADE = "Belo Horizonte"; - cl6.UF = "MG"; - cl6.cep = "31650-560"; - cl6.telefone = "3195004414"; - - Cliente cl7; - cl7.NOME = "Leova Wikyecil Neaca"; - cl7.endereco = "Rua João Arantes - Cidade Nova"; - cl7.CIDADE = "Belo Horizonte"; - cl7.UF = "MG"; - cl7.cep = "31170-240"; - cl7.telefone = "3198461192"; - - Cliente cl8; - cl8.NOME = "Teas Heimeu Pipe"; - cl8.endereco = "Rua Maria Pereira Damasceno - Ernesto do Nascimento(Barreiro)"; - cl8.CIDADE = "Belo Horizonte"; - cl8.UF = "MG"; - cl8.cep = "30668-430"; - cl8.telefone = "3197317802"; - - int qtdeA = 0; - int qtdeCa = 0; - int qtdeCb = 0; - - Apartamento ap1; - ap1.corretor = "Tuoruars"; - ap1.AREA = 55.4; - ap1.Q = 2; - ap1.B = 1; - ap1.V = 0; - ap1.VALORm2 = 987.0; - ap1.C = ap1.comissao(); - ap1.Valor = ap1.valor() + ap1.comissao(); - ap1.vendedor = cl1; - qtdeA++; - - Apartamento ap2; - ap2.corretor = "Fyubyeis"; - ap2.AREA = 74.5; - ap2.Q = 2; - ap2.B = 1; - ap2.V = 2; - ap2.VALORm2 = 1540.0; - ap2.C = ap2.comissao(); - ap2.Valor = ap2.valor() + ap2.comissao(); - ap2.vendedor = cl2; - qtdeA++; - - Apartamento ap3; - ap3.corretor = "Kelia"; - ap3.AREA = 87.2; - ap3.Q = 3; - ap3.B = 2; - ap3.V = 2; - ap3.VALORm2 = 2354.0; - ap3.C = ap3.comissao(); - ap3.Valor = ap3.valor() + ap3.comissao(); - ap3.vendedor = cl3; - qtdeA++; - - // Cobertura - Cobertura cb1; - cb1.corretor = "Koci"; - cb1.AREA = 120.1; - cb1.Q = 3; - cb1.B = 3; - cb1.V = 2; - cb1.VALORm2 = 3123.5; - cb1.C = cb1.comissao(); - cb1.Valor = cb1.valor() + cb1.comissao(); - cb1.vendedor = cl4; - qtdeCb++; - - Cobertura cb2; - cb2.corretor = "Wail"; - cb2.AREA = 134.8; - cb2.Q = 4; - cb2.B = 3; - cb2.V = 3; - cb2.VALORm2 = 3578.2; - cb2.C = cb2.comissao(); - cb2.Valor = cb2.valor() + cb2.comissao(); - cb2.vendedor = cl5; - qtdeCb++; - - Cobertura cb3; - cb3.corretor = "Fival"; - cb3.AREA = 180.0; - cb3.Q = 4; - cb3.B = 4; - cb3.V = 4; - cb3.VALORm2 = 4165.7; - cb3.C = cb3.comissao(); - cb3.Valor = cb3.valor() + cb3.comissao(); - cb3.vendedor = cl6; - qtdeCb++; - - // Casas - Casa ca1; - ca1.corretor = "Beydo"; - ca1.AREA = 145.6; - ca1.Q = 3; - ca1.B = 3; - ca1.V = 2; - ca1.VALORm2 = 4023.6; - ca1.C = ca1.comissao(); - ca1.Valor = ca1.valor() + ca1.comissao(); - ca1.vendedor = cl7; - qtdeCa++; - - Casa ca2; - ca2.corretor = "Riuzi"; - ca2.AREA = 245.0; - ca2.Q = 5; - ca2.B = 4; - ca2.V = 4; - ca2.VALORm2 = 4856.2; - ca2.C = ca2.comissao(); - ca2.Valor = ca2.valor() + ca2.comissao(); - ca2.vendedor = cl8; - qtdeCa++; - - std::cout << "\n>> Relatório de Imóveis <<" << endl; - - double valorAp = 0.0; - double valorCb = 0.0; - double valorCa = 0.0; - double comissAp = 0.0; - double comissCb = 0.0; - double comissCa = 0.0; - - ap1.print(); - valorAp += ap1.valor(); - comissAp += ap1.comissao(); - std::cout << endl; - - ap2.print(); - valorAp += ap2.valor(); - comissAp += ap2.comissao(); - std::cout << endl; - - ap3.print(); - valorAp += ap3.valor(); - comissAp += ap3.comissao(); - std::cout << endl; - - cb1.print(); - valorCb += cb1.valor(); - comissCb += cb1.comissao(); - std::cout << endl; - - cb2.print(); - valorCb += cb2.valor(); - comissCb += cb2.comissao(); - std::cout << endl; - - cb3.print(); - valorCb += cb3.valor(); - comissCb += cb3.comissao(); - std::cout << endl; - - ca1.print(); - valorCa += ca1.valor(); - comissCa += ca1.comissao(); - std::cout << endl; - - ca2.print(); - valorCa += ca2.valor(); - comissCa += ca2.comissao(); - std::cout << endl; - - std::cout << "\n>> Resumo Geral <<" << endl; - - std::cout << "\n>>Apartamentos<<\n" - << "\n Quantidade: " << qtdeA - << "\n Valor Total: R$ " << fixed << setprecision(2) << valorAp - << "\n Comissão Total: R$" << comissAp - << endl - << "\n>>Coberturas<<\n" - << "\n Quantidade: " << qtdeCb - << "\n Valor Total: R$ " << fixed << setprecision(2) << valorCb - << "\n Comissão Total: R$ " << fixed << setprecision(2) << comissCb - << endl - << "\n>>Casas<<\n" - << "\n Quantidade: " << qtdeCa - << "\n Valor Total: R$ " << fixed << setprecision(2) << valorCa - << "\n Comissão Total: R$ " << fixed << setprecision(2) << comissCa - << endl; -} diff --git a/sistema b/sistema new file mode 100755 index 0000000..a001d7d Binary files /dev/null and b/sistema differ diff --git a/src/entidades/Apartamento.cpp b/src/entidades/Apartamento.cpp new file mode 100644 index 0000000..b54bef0 --- /dev/null +++ b/src/entidades/Apartamento.cpp @@ -0,0 +1,25 @@ +#include "Apartamento.hpp" + +Apartamento::Apartamento(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor) + :Imovel(area, quartos, banheiros, vagas, valor_m2, vendedor, corretor){ + _valor_venda = this->valor() + this->comissao(); + _valor_comissao = this->comissao(); + } + +double Apartamento::comissao(){ + double valor_total = this->valor(); + + return valor_total * comissao_taxa; +} + +void Apartamento::print(){ + std::cout << "[Apartamento]" << endl; + Imovel::print(); + std::cout << "Area: " << _area << endl + << " Quartos: " << _quartos << endl + << " Banheiros: " << _banheiros << endl + << " Vagas: " << _vagas << endl + << "Taxa de Comissão: " << comissao_taxa * 100 << "%" << endl + << "Valor Comissão: R$ " << fixed << setprecision(2) << _valor_comissao << endl + << "Valor de Venda: R$ " << fixed << setprecision(2) << _valor_venda << endl; +} diff --git a/src/entidades/Casa.cpp b/src/entidades/Casa.cpp new file mode 100644 index 0000000..5a2f34e --- /dev/null +++ b/src/entidades/Casa.cpp @@ -0,0 +1,25 @@ +#include "Casa.hpp" + +Casa::Casa(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor) + :Imovel(area, quartos, banheiros, vagas, valor_m2, vendedor, corretor){ + _valor_venda = this->valor() + this->comissao(); + _valor_comissao = this->comissao(); + } + +double Casa::comissao(){ + double valor_total = this->valor(); + + return valor_total * comissao_taxa; +} + +void Casa::print(){ + std::cout << "[Casa]" << endl; + Imovel::print(); + std::cout << "Area: " << _area << endl + << " Quartos: " << _quartos << endl + << " Banheiros: " << _banheiros << endl + << " Vagas: " << _vagas << endl + << "Taxa de Comissão: " << comissao_taxa * 100 << "%" << endl + << "Valor Comissão: R$ " << fixed << setprecision(2) << _valor_comissao << endl + << "Valor de Venda: R$ " << fixed << setprecision(2) << _valor_venda << endl; +} \ No newline at end of file diff --git a/src/entidades/Cliente.cpp b/src/entidades/Cliente.cpp new file mode 100644 index 0000000..7482b7c --- /dev/null +++ b/src/entidades/Cliente.cpp @@ -0,0 +1,59 @@ +#include +#include +#include "Cliente.hpp" + +Cliente::Cliente(string nome, string endereco, string cidade, string uf, string cep, string telefone){ + _nome = nome; + _telefone = telefone; + _endereco = endereco; + _cidade = cidade; + _uf = uf; + _cep = cep; +} + +void Cliente::print(){ + std::cout << " Nome: " << this->get_nome() << endl + << " Telefone: " << this->get_telefone() << endl + << " Endereço: " << this->get_endereco() << endl + << " Cidade: " << this->get_cidade() << endl + << " Estado: " << this->get_uf() << endl + << " CEP: " << this->get_cep() << endl; +} + +string Cliente::get_nome(){ + return _nome; +} +string Cliente::get_telefone(){ + return _telefone; +} +string Cliente::get_endereco(){ + return _endereco; +} +string Cliente::get_cidade(){ + return _cidade; +} +string Cliente::get_uf(){ + return _uf; +} +string Cliente::get_cep(){ + return _cep; +} + +void Cliente::set_nome(string nome){ + _nome = nome; +} +void Cliente::set_endereco(string endereco){ + _endereco = endereco; +} +void Cliente::set_cidade(string cidade){ + _cidade = cidade; +} +void Cliente::set_uf(string uf){ + _uf = uf; +} +void Cliente::set_cep(string cep){ + _cep = cep; +} +void Cliente::set_telefone(string telefone){ + _telefone = telefone; +} diff --git a/src/entidades/Cobertura.cpp b/src/entidades/Cobertura.cpp new file mode 100644 index 0000000..036eae5 --- /dev/null +++ b/src/entidades/Cobertura.cpp @@ -0,0 +1,25 @@ +#include "Cobertura.hpp" + +Cobertura::Cobertura(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor) + :Imovel(area, quartos, banheiros, vagas, valor_m2, vendedor, corretor){ + _valor_venda = this->valor() + this->comissao(); + _valor_comissao = this->comissao(); + } + +double Cobertura::comissao(){ + double valor_total = this->valor(); + + return valor_total * comissao_taxa; +} + +void Cobertura::print(){ + std::cout << "[Cobertura]" << endl; + Imovel::print(); + std::cout << "Area: " << _area << endl + << " Quartos: " << _quartos << endl + << " Banheiros: " << _banheiros << endl + << " Vagas: " << _vagas << endl + << "Taxa de Comissão: " << comissao_taxa * 100 << "%" << endl + << "Valor Comissão: R$ " << fixed << setprecision(2) << _valor_comissao << endl + << "Valor de Venda: R$ " << fixed << setprecision(2) << _valor_venda << endl; +} \ No newline at end of file diff --git a/src/entidades/Imovel.cpp b/src/entidades/Imovel.cpp new file mode 100644 index 0000000..1b2a61e --- /dev/null +++ b/src/entidades/Imovel.cpp @@ -0,0 +1,24 @@ +#include "Imovel.hpp" + +Imovel::Imovel(double area, int quartos, int banheiros, int vagas, double valor_m2, Cliente vendedor, string corretor){ + _area = area; + _quartos = quartos; + _banheiros = banheiros; + _vagas = vagas; + _valor_m2 = valor_m2; + _vendedor = vendedor; + _corretor = corretor; +} + +void Imovel::print(){ + std::cout << "[Vendedor]" << std::endl; + _vendedor.print(); + std::cout << "[Corretor]" << std::endl; + std::cout << " " + _corretor << std::endl; +} + +double Imovel::valor(){ + double valor = this->_area * this->_valor_m2; + + return valor; +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..99e8544 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,118 @@ +#include +#include + +#include "Imovel.hpp" +#include "Casa.hpp" +#include "Cobertura.hpp" +#include "Apartamento.hpp" +#include "Cliente.hpp" + +int main() { + + Cliente cl1("Xayso Sovon Ziahaka", "Rua Xangrilá - Braúnas", "Belo Horizonte", "MG", "31365-570", "3196007958"); + Cliente cl2("Minia Pasies Kituos", "Rua dos Jacobinos - Ouro Minas", "Belo Horizonte", "MG", "31870-290", "3197627067"); + Cliente cl3("Vuocue Leiur Baonauza", "Rua Orminda de Almeida - Tupi B", "Belo Horizonte", "MG", "31842-630", "3195949327"); + Cliente cl4("Zerer Huduy Fyogar", "Rua Taquaril - Jonas Veiga", "Belo Horizonte", "MG", "30285-422", "3198596327"); + Cliente cl5("Ceziel Mioti Pler", "Rua João Gualberto Costa - Serrano", "Belo Horizonte","MG", "30882-747", "3196274465"); + Cliente cl6("Esxo Cilal Zyais", "Rua Américo Luiz Moreira - Jardim dos Comerciários (Venda Nova)", "Belo Horizonte", "MG", "31650-560", "3195004414"); + Cliente cl7("Leova Wikyecil Neaca", "Rua João Arantes - Cidade Nova", "Belo Horizonte", "MG", "31170-240", "3198461192"); + Cliente cl8("Teas Heimeu Pipe", "Rua Maria Pereira Damasceno - Ernesto do Nascimento(Barreiro)", "Belo Horizonte", "MG", "30668-430", "3197317802"); + + int quantidade_apartamentos = 0; + int quantidade_casas = 0; + int quantidade_coberturas = 0; + + //Apartamentos + Apartamento ap1(55.4, 2, 1, 0, 987.0, cl1, "Tuoruars"); + quantidade_apartamentos++; + + Apartamento ap2(74.5, 2, 1, 2, 1540.0, cl2, "Fyubyeis"); + quantidade_apartamentos++; + + Apartamento ap3(87.2, 3, 2, 2, 2354.0, cl3, "Kelia"); + quantidade_apartamentos++; + + // Coberturas + Cobertura cb1(120.1, 3, 3, 2, 3123.5, cl4, "Koci"); + quantidade_coberturas++; + + Cobertura cb2(134.8, 4, 3, 3, 3578.2, cl5, "Wail"); + quantidade_coberturas++; + + Cobertura cb3(180.0, 4, 4, 4, 4165.7, cl6, "Fival" ); + quantidade_coberturas++; + + // Casas + Casa ca1(145.6, 3, 3, 2, 4023.6, cl7, "Beydo"); + quantidade_casas++; + + Casa ca2(245.0, 5, 4, 4, 4856.2, cl8,"Riuzi" ); + quantidade_casas++; + + std::cout << "\n>> Relatório de Imóveis <<" << endl; + + double valor_total_apartamentos = 0.0; + double valor_total_coberturas = 0.0; + double valor_total_casas = 0.0; + double comissao_total_apartamentos = 0.0; + double comissao_total_coberturas = 0.0; + double comissao_total_casas = 0.0; + + ap1.print(); + valor_total_apartamentos += ap1.valor(); + comissao_total_apartamentos += ap1.comissao(); + std::cout << endl; + + ap2.print(); + valor_total_apartamentos += ap2.valor(); + comissao_total_apartamentos += ap2.comissao(); + std::cout << endl; + + ap3.print(); + valor_total_apartamentos += ap3.valor(); + comissao_total_apartamentos += ap3.comissao(); + std::cout << endl; + + cb1.print(); + valor_total_coberturas += cb1.valor(); + comissao_total_coberturas += cb1.comissao(); + std::cout << endl; + + cb2.print(); + valor_total_coberturas += cb2.valor(); + comissao_total_coberturas += cb2.comissao(); + std::cout << endl; + + cb3.print(); + valor_total_coberturas += cb3.valor(); + comissao_total_coberturas += cb3.comissao(); + std::cout << endl; + + ca1.print(); + valor_total_casas += ca1.valor(); + comissao_total_casas += ca1.comissao(); + std::cout << endl; + + ca2.print(); + valor_total_casas += ca2.valor(); + comissao_total_casas += ca2.comissao(); + std::cout << endl; + + std::cout << "\n>> Resumo Geral <<" << endl; + + std::cout << "\n>>Apartamentos<<\n" + << "\n Quantidade: " << quantidade_apartamentos + << "\n Valor Total: R$ " << fixed << setprecision(2) << valor_total_apartamentos + << "\n Comissão Total: R$" << comissao_total_apartamentos + << endl + << "\n>>Coberturas<<\n" + << "\n Quantidade: " << quantidade_coberturas + << "\n Valor Total: R$ " << fixed << setprecision(2) << valor_total_coberturas + << "\n Comissão Total: R$ " << fixed << setprecision(2) << comissao_total_coberturas + << endl + << "\n>>Casas<<\n" + << "\n Quantidade: " << quantidade_casas + << "\n Valor Total: R$ " << fixed << setprecision(2) << valor_total_casas + << "\n Comissão Total: R$ " << fixed << setprecision(2) << comissao_total_casas + << endl; +}