summaryrefslogtreecommitdiffstats
path: root/2022-2/L10/mitsuo/Marca.cpp
diff options
context:
space:
mode:
Diffstat (limited to '2022-2/L10/mitsuo/Marca.cpp')
-rw-r--r--2022-2/L10/mitsuo/Marca.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/2022-2/L10/mitsuo/Marca.cpp b/2022-2/L10/mitsuo/Marca.cpp
new file mode 100644
index 0000000..25907fe
--- /dev/null
+++ b/2022-2/L10/mitsuo/Marca.cpp
@@ -0,0 +1,51 @@
+/*
+ * File: Marca.cpp
+ * Author: mitsuo
+ *
+ * Created on 02 December 2022, 12:36
+ */
+
+#include <iostream>
+#include <iomanip>
+#include "Marca.h"
+#include "aux.h"
+
+using namespace std;
+
+Marca::Marca() {
+ this->laboratorio = new char [MAXLEN];
+}
+
+Marca::Marca(const Marca& orig) {
+}
+
+Marca::~Marca() {
+ delete [] this->laboratorio;
+}
+
+int Marca::lee(std::istream &input) {
+ this->Medicamento::lee(input);
+ input.getline(this->laboratorio, MAXLEN, ',');
+ input >> this->lote;
+
+ return !input.eof();
+}
+
+void Marca::imprime(std::ostream &output) {
+ this->Medicamento::imprime(output);
+ output << WL(40) << this->laboratorio;
+ output << WL(8) << this->lote;
+ output << '\n';
+}
+
+void Marca::actualiza(std::istream &input) {
+ input.clear();
+ input.seekg(0); // rewind
+
+ int codigo;
+ while (input >> codigo) {
+ if (codigo == this->getCodigo()) {
+ this->setPrecio(this->getPrecio() * 1.2);
+ }
+ }
+}