Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fb9a981a9949285fc4177e1a18d50d18 #127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Apartamento.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#include "Imovel.hpp"
#include "Cliente.hpp"
#include "Apartamento.hpp"

#define TAXA 0.04

double Apartamento::valor(){
double v = AREA * VALORm2;
return v;
}

double Apartamento::comissao(){
double c = AREA * VALORm2;
return c * TAXA;
}

void Apartamento::print(){
std::cout << "[Apartamento]" << std::endl;
Imovel::print();
std::cout << "Area: " << AREA << std::endl
<< " Quartos: " << Q << std::endl
<< " Banheiros: " << B << std::endl
<< " Vagas: " << V << std::endl
<< "Taxa de Comissão: " << 4 << "%" << std::endl
<< "Valor Comissão: R$ " << std::fixed << std::setprecision(2) << C << std::endl
<< "Valor de Venda: R$ " << std::fixed << std::setprecision(2) << Valor << std::endl;
}
32 changes: 3 additions & 29 deletions Apartamento.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,14 @@
#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() {
double valor() override;
double comissao() override;
void print() override;

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
27 changes: 27 additions & 0 deletions Casa.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "Imovel.hpp"
#include "Cliente.hpp"
#include "Casa.hpp"

#define TAXA 0.06

double Casa::valor(){
double v = AREA * VALORm2;
return v;
}

double Casa::comissao(){
double c = AREA * VALORm2;
return c * TAXA;
}

void Casa::print(){
std::cout << "[Casa]" << std::endl;
Imovel::print();
std::cout << "Area: " << AREA << std::endl
<< " Quartos: " << Q << std::endl
<< " Banheiros: " << B << std::endl
<< " Vagas: " << V << std::endl
<< "Taxa de Comissão: " << 6 << "%" << std::endl
<< "Valor Comissão: R$ " << std::fixed << std::setprecision(2) << C << std::endl
<< "Valor de Venda: R$ " << std::fixed << std::setprecision(2) << Valor << std::endl;
}
34 changes: 3 additions & 31 deletions Casa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,13 @@
#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;

}
double valor() override;
double comissao() override;
void print() override;

};

Expand Down
12 changes: 6 additions & 6 deletions Cliente.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

void Cliente::print(){

std::cout << " Nome: " << NOME << endl
<< " Telefone: " << telefone << endl
<< " Endereço: " << endereco << endl
<< " Cidade: " << CIDADE << endl
<< " Estado: " << UF << endl
<< " CEP: " << cep << endl;
std::cout << " Nome: " << NOME << std::endl
<< " Telefone: " << telefone << std::endl
<< " Endereço: " << endereco << std::endl
<< " Cidade: " << CIDADE << std::endl
<< " Estado: " << UF << std::endl
<< " CEP: " << cep << std::endl;

}
13 changes: 6 additions & 7 deletions Cliente.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
#define CLIENTE_HPP

#include <string>
using namespace std;

class Cliente {
public:
string NOME;
string endereco;
string CIDADE;
string UF;
string cep;
string telefone;
std::string NOME;
std::string endereco;
std::string CIDADE;
std::string UF;
std::string cep;
std::string telefone;

void print();
};
Expand Down
28 changes: 28 additions & 0 deletions Cobertura.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "Imovel.hpp"
#include "Cliente.hpp"
#include "Cobertura.hpp"

#define TAXA 0.10

double Cobertura::valor(){
double v = AREA * VALORm2;
return v;
}

double Cobertura::comissao(){
double c = AREA * VALORm2;
return c * TAXA;
}

void Cobertura::print(){

std::cout << "[Cobertura]" << std::endl;
Imovel::print();
std::cout << "Area: " << AREA << std::endl
<< " Quartos: " << Q << std::endl
<< " Banheiros: " << B << std::endl
<< " Vagas: " << V << std::endl
<< "Taxa de Comissão: " << 10 << "%" << std::endl
<< "Valor Comissão: R$ " << std::fixed << std::setprecision(2) << C << std::endl
<< "Valor de Venda: R$ " << std::fixed << std::setprecision(2) << Valor << std::endl;
}
31 changes: 3 additions & 28 deletions Cobertura.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,15 @@

#include "Imovel.hpp"
#include "Cliente.hpp"
using namespace std;

class Cobertura : public Imovel {

public:

double valor() {
double valor() override;
double comissao() override;
void print() override;

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
11 changes: 11 additions & 0 deletions Imovel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <iostream>
#include <iomanip>
#include "Cliente.hpp"
#include "Imovel.hpp"

void Imovel:: print(){
std::cout << "[Vendedor]" << std::endl;
vendedor.print();
std::cout << "[Corretor]" << std::endl;
std::cout << " " + corretor << std::endl;
}
15 changes: 6 additions & 9 deletions Imovel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <iomanip>
#include "Cliente.hpp"

using namespace std;

class Imovel {
public:
double AREA;
Expand All @@ -17,14 +15,13 @@ class Imovel {
double Valor;
double C;
Cliente vendedor;
string corretor;
std::string corretor;

virtual double valor() = 0;
virtual double comissao() = 0;
virtual void print();
virtual ~Imovel() {}

void print() {
cout << "[Vendedor]" << endl;
vendedor.print();
cout << "[Corretor]" << endl;
cout << " " + corretor << endl;
}
};

#endif
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Exercício de Revisão e Refatoração

Atividade da matéria Programação e Desenvolvimento de Software II da Universidade Federal de Minas Gerais (UFMG).

O objetivo dessa atividade é praticar a parte de revisão e refatoração utilizando um sistema de controle de versão.

**Considere a seguinte descrição em alto nível da funcionalidade do código:**
Expand Down
Loading