Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit f4f4d26

Browse files
committed
Classes da lista 4 implementadas
1 parent f86385f commit f4f4d26

20 files changed

+320
-0
lines changed

cpp/lista4jordana/Cilindro.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "Cilindro.hpp"
2+
#include "Forma3D.hpp"
3+
4+
Cilindro::Cilindro(double raio, double altura)
5+
{
6+
this->setRaio(raio);
7+
this->setAltura(altura);
8+
}
9+
10+
double Cilindro::getRaio()
11+
{
12+
return this->raio;
13+
}
14+
15+
void Cilindro::setRaio(double raio)
16+
{
17+
this->raio = raio;
18+
}
19+
20+
double Cilindro::getAltura()
21+
{
22+
return this->altura;
23+
}
24+
25+
void Cilindro::setAltura(double altura)
26+
{
27+
this->altura = altura;
28+
}

cpp/lista4jordana/Cilindro.hpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#ifndef _CILINDRO_
2+
#define _CILINDRO_
3+
#include "Forma3D.hpp"
4+
5+
using namespace std;
6+
7+
class Cilindro: public Forma3D
8+
{
9+
private:
10+
double raio;
11+
double altura;
12+
13+
public:
14+
Cilindro(double raio, double altura);
15+
double getRaio();
16+
void setRaio(double raio);
17+
double getAltura();
18+
void setAltura(double altura);
19+
};
20+
21+
#endif

cpp/lista4jordana/Circulo.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "Circulo.hpp"
2+
#include "Forma2D.hpp"
3+
4+
Circulo::Circulo(double raio)
5+
{
6+
this->setRaio(raio);
7+
}
8+
9+
double Circulo::getRaio()
10+
{
11+
return this->raio;
12+
}
13+
14+
void Circulo::setRaio(double raio)
15+
{
16+
this->raio = raio;
17+
}

cpp/lista4jordana/Circulo.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef _CIRCULO_
2+
#define _CIRCULO_
3+
#include "Forma2D.hpp"
4+
5+
using namespace std;
6+
7+
class Circulo: public Forma2D
8+
{
9+
private:
10+
double raio;
11+
12+
public:
13+
Circulo(double raio);
14+
double getRaio();
15+
void setRaio(double raio);
16+
};
17+
18+
#endif

cpp/lista4jordana/Cubo.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "Cubo.hpp"
2+
#include "Forma3D.hpp"
3+
4+
Cubo::Cubo(double lado)
5+
{
6+
this->setLado(lado);
7+
}
8+
9+
double Cubo::getLado()
10+
{
11+
return this->lado;
12+
}
13+
14+
void Cubo::setLado(double lado)
15+
{
16+
this->lado = lado;
17+
}
18+
19+
double Cubo::calcularArea()
20+
{
21+
return this->lado * this->lado * 6;
22+
}
23+
24+
void Cubo::imprimirDados()
25+
{
26+
cout << "CUBO:\n" << "LADO DO CUBO:\n" << this->lado << endl << "AREA DO SUPERFICIE DO CUBO:\n" << this->calcularArea() << endl << "VOLUME DO CUBO:\n" << this->calcularVolume() << endl;
27+
}
28+
29+
double Cubo::calcularVolume()
30+
{
31+
return this->lado * this->lado * this->lado;
32+
}

cpp/lista4jordana/Cubo.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#ifndef _CUBO_
2+
#define _CUBO_
3+
#include "Forma3D.hpp"
4+
#include <cmath>
5+
6+
using namespace std;
7+
8+
class Cubo: public Forma3D
9+
{
10+
private:
11+
double lado;
12+
13+
double getLado() {
14+
return lado;
15+
}
16+
17+
public:
18+
Cubo(double lado);
19+
double getLado();
20+
void setLado(double lado);
21+
double calcularArea();
22+
void imprimirDados();
23+
double calcularVolume();
24+
};
25+
26+
#endif

cpp/lista4jordana/Esfera.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include "Esfera.hpp"
2+
3+
Esfera::Esfera(double raio)
4+
{
5+
this->setRaio(raio);
6+
}
7+
8+
double Esfera::getRaio()
9+
{
10+
return this->raio;
11+
}
12+
13+
void Esfera::setRaio(double raio)
14+
{
15+
this->raio = raio;
16+
}
17+
18+
double Esfera::calcularArea()
19+
{
20+
return 4 * (M_PI) * (this->raio * this->raio);
21+
}
22+
23+
void Esfera::imprimirDados()
24+
{
25+
cout << "ESFERA:\n" << "RAIO DA ESFERA:\n" << this->raio << endl << "AREA DA SUPERFICIE DA ESFERA:\n" << this->calcularArea() << endl << "VOLUME DA ESFERA:\n" << this->calcularVolume() << endl;
26+
}
27+
28+
double Esfera::calcularVolume()
29+
{
30+
return (4.0/3.0) * (M_PI) * (this->raio * this->raio * this->raio);
31+
}

cpp/lista4jordana/Esfera.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef _ESFERA_
2+
#define _ESFERA_
3+
#include <cmath>
4+
#include "Forma3D.hpp"
5+
6+
using namespace std;
7+
8+
class Esfera: public Forma3D
9+
{
10+
private:
11+
double raio;
12+
13+
public:
14+
Esfera(double raio);
15+
double getRaio();
16+
void setRaio(double raio);
17+
double calcularArea();
18+
void imprimirDados();
19+
double calcularVolume();
20+
};
21+
22+
#endif

cpp/lista4jordana/Forma.cpp

Whitespace-only changes.

cpp/lista4jordana/Forma.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef _FORMA_
2+
#define _FORMA_
3+
#include <iostream>
4+
5+
class Forma
6+
{
7+
public:
8+
virtual double calcularArea() = 0;
9+
virtual void imprimirDados() = 0;
10+
};
11+
12+
#endif

0 commit comments

Comments
 (0)