Skip to content

Commit

Permalink
Merge pull request #47 from studas/lista06/ex04
Browse files Browse the repository at this point in the history
Lista06/ex04
  • Loading branch information
CarlosCraveiro authored Oct 31, 2022
2 parents 7926fad + 5ddd59a commit 44b9964
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lista06/ex04/src/Radio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Radio.hpp"

Radio::Radio(float estacao, bool amfm) {
this->_isLigado = 0;
this->_estacao = estacao;
this->_amfm = amfm;
}

auto Radio::setarEstacao(float estacao) -> void {
this->_estacao = estacao;
}

auto Radio::mudarAmFm(bool amfm) -> void {
this->_amfm = amfm;
}

auto Radio::ligarDesligar(bool isLigado) -> void {
this->_isLigado = isLigado;
}
14 changes: 14 additions & 0 deletions lista06/ex04/src/Radio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

class Radio {
private:
bool _isLigado;
float _estacao;
bool _amfm;

public:
Radio(float estacao, bool amfm);
auto setarEstacao(float estacao) -> void;
auto mudarAmFm(bool amfm) -> void;
auto ligarDesligar(bool isLigado) -> void;
};
6 changes: 6 additions & 0 deletions lista06/ex04/src/Radiorelogio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "Radiorelogio.hpp"

auto Radiorelogio::alarmeSintonizar(int hora, int minuto, int segundo , float estacao) -> void {
Relogio::definirAlarme(hora, minuto, segundo);
Radio::setarEstacao(estacao);
};
9 changes: 9 additions & 0 deletions lista06/ex04/src/Radiorelogio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include "Radio.hpp"
#include "Relogio.hpp"

class Radiorelogio : public Radio, public Relogio {
public:
Radiorelogio(float estacao, bool amfm, int hora, int minuto, int segundo) : Radio(estacao, amfm), Relogio(hora, minuto, segundo) {}
auto alarmeSintonizar(int hora, int minuto, int segundo , float estacao) -> void;
};
18 changes: 18 additions & 0 deletions lista06/ex04/src/Relogio.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "Relogio.hpp"
#include <iostream>

auto Relogio::exibirHoras() -> void {
std::cout << "Horario: " << this->_horas << ":" << this->_minutos << ":" << this->_segundos << "\n";
}

auto Relogio::definirHoras(int horaDef, int minutoDef, int segundoDef) -> void {
this->_horas = horaDef;
this->_minutos = minutoDef;
this->_segundos = segundoDef;
}

auto Relogio::definirAlarme(int horaAlarme, int minutoAlarme, int segundoAlarme) -> void {
this->_horasAlarme = horaAlarme;
this->_minutosAlarme = minutoAlarme;
this->_segundosAlarme = segundoAlarme;
}
17 changes: 17 additions & 0 deletions lista06/ex04/src/Relogio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

class Relogio {
protected:
int _horas;
int _minutos;
int _segundos;
int _horasAlarme;
int _minutosAlarme;
int _segundosAlarme;

public:
Relogio(int hora, int minuto, int segundo): _horas{ hora }, _minutos{ minuto }, _segundos{ segundo } {};
auto exibirHoras() -> void;
auto definirHoras(int horaDef, int minutoDef, int segundoDef) -> void;
auto definirAlarme(int horaAlarme, int minutoAlarme, int segundoAlarme) -> void;
};
Binary file added lista06/ex04/src/a.out
Binary file not shown.
6 changes: 6 additions & 0 deletions lista06/ex04/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "Relogio.hpp"
#include "Radio.hpp"

auto main() -> int {

}

0 comments on commit 44b9964

Please sign in to comment.