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

Aluno #168 #168

Open
wants to merge 1 commit into
base: master
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
14 changes: 6 additions & 8 deletions Cliente.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#include <string>
#include "Cliente.hpp"

void Cliente::print(){

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

void Cliente::printCliente(){
std::cout << " Nome: " << getNome() << endl
<< " Endereço: " << getEndereco() << endl
<< " Cidade: " << getCidade() << endl
<< " Estado: " << getEstado() << endl
<< " CEP: " << getCep() << endl;
}
27 changes: 18 additions & 9 deletions Cliente.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
using namespace std;

class Cliente{

public:
string getNome() {return this->_nome;}
string getEndereco() {return this->_endereco;}
string getCidade() {return this->_cidade;}
string getEstado() {return this->_estado;}
string getCep() {return this->_cep;}

void setNome(string nome) {this->_nome = nome;}
void setEndereco(string endereco) {this->_endereco = endereco;}
void setCidade(string cidade) {this->_cidade = cidade;}
void setEstado(string estado) {this->_estado = estado;}
void setCep(string cep) {this->_cep = cep;}

string NOME;
string endereco;
string CIDADE;
string ESTADO;
string cep;

void print(); // imprime na tela os dados de um cliente cadastrado

void printCliente(); // imprime na tela os dados de um cliente cadastrado
private:
string _nome;
string _endereco;
string _cidade;
string _estado;
string _cep;
};

#endif
30 changes: 20 additions & 10 deletions Encomenda.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@ using namespace std;
class Encomenda{

public:
double getPeso() {return this->_peso;}
double getCustokg() {return this->_custoKg;}
double getCustoTotal() {return this->_custoTotal;}
Cliente getRemetente() {return this->_remetente;}
Cliente getDest() {return this->_destinatario;}

double PESO = 0.0;
double CUSTOkg = 0.0;
double T = 0.0;
Cliente remetente;
Cliente dest;
void print(){

void setPeso(double peso) {this->_peso = peso;}
void setCustokg(double custoKg) {this->_custoKg = custoKg;}
void setRemetente(Cliente remetente) {this->_remetente = remetente;}
void setDest(Cliente destinatario) {this->_destinatario = destinatario;}

void printEncomenda(){

std::cout << "[Remetente]" << endl;
remetente.print();
getRemetente().printCliente();
std::cout << "[Destinatário]" << endl;
dest.print();
getDest().printCliente();
}

protected:
double _peso = 0.0;
double _custoKg = 0.0;
double _custoTotal = 0.0;
Cliente _remetente;
Cliente _destinatario;
};

#endif
37 changes: 16 additions & 21 deletions EncomendaNormal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,22 @@
#include "Cliente.hpp"
using namespace std;

class EncomendaNormal: public Encomenda{

public:

double calcula(){

double x = PESO * CUSTOkg;

return x;
}

void print(){

Encomenda::print();
std::cout << "[Encomenda Normal]" << endl;
std::cout << " Peso: " << PESO << endl
<< " Custo por kg: " << CUSTOkg << endl
<< " Custo total: " << T << endl;

}

class EncomendaNormal: public Encomenda
{
public:
double calculaCustoFinal()
{
return (getPeso() * getCustokg());
}

void printEncomendaNormal()
{
Encomenda::printEncomenda();
std::cout << "[Encomenda Normal]" << endl;
std::cout << " Peso: " << getPeso() << endl
<< " Custo por kg: " << getCustokg() << endl
<< " Custo total: " << getCustoTotal() << endl;
}
};

#endif
30 changes: 15 additions & 15 deletions EncomendaRelampago.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
#include "Cliente.hpp"
using namespace std;

class EncomendaRelampago: public Encomenda{

class EncomendaRelampago: public Encomenda
{
public:
double getTaxaAdd() {return this->_taxaAdicional;}

double calcula(){

double x = PESO * CUSTOkg;
x += x * 0.25;

return x;
double calculaCustoFinal()
{
return ((getPeso() * getCustokg()) * (1 + getTaxaAdd()));
}

void print(){
void printEncomendaRelampago()
{

Encomenda::print();
Encomenda::printEncomenda();
std::cout << "[Encomenda Relâmpago]" << endl;
std::cout << " Peso: " << PESO << endl
<< " Custo por kg: " << CUSTOkg << endl
<< " Taxa adicional: " << 0.25 << endl
<< " Custo total: " << T << endl;
std::cout << " Peso: " << getPeso() << endl
<< " Custo por kg: " << getCustokg() << endl
<< " Taxa adicional: " << getTaxaAdd() << endl
<< " Custo total: " << getCustoTotal() << endl;

}

private:
double _taxaAdicional = 0.25;
};

#endif
Loading