Website Summary Files Commits Branches @commit @diff @stats
path: root / week11 / Exercise03
diff options
context:
space:
mode:
Commit7b19cabee8b08478f31f6e4594ed28e1d04e153c (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-05-10 10:10:21 +0300
Committer
 Syndamia <kamen@syndamia.com>
2024-05-10 10:10:21 +0300
Files3574b2c3fd75ab66701def640fe7476651236184 /week11/Exercise03
oop-2023-solutions-7b19cabee8b08478f31f6e4594ed28e1d04e153c.tar
oop-2023-solutions-7b19cabee8b08478f31f6e4594ed28e1d04e153c.tar.gz
oop-2023-solutions-7b19cabee8b08478f31f6e4594ed28e1d04e153c.zip
Parent437e306dc9b79905105fb2e8af6dd1eae1b908ae (diff)
[w11] Solved exercises
diff --git a/week11/Exercise03/Camera.cpp b/week11/Exercise03/Camera.cpp
new file mode 100644
index 0000000..b56a702
--- /dev/null
+++ b/week11/Exercise03/Camera.cpp
@@ -0,0 +1,8 @@
+#include "Camera.h"
+#include "Electronics.h"
+#include <iostream>
+
+void Camera::Print() {
+ Electroics::Print();
+ std::cout << ' ' << resolution;
+}
diff --git a/week11/Exercise03/Camera.h b/week11/Exercise03/Camera.h
new file mode 100644
index 0000000..d9e480f
--- /dev/null
+++ b/week11/Exercise03/Camera.h
@@ -0,0 +1,9 @@
+#pragma once
+#include "Electronics.h"
+
+class Camera : Electronics {
+ float resolution;
+
+public:
+ virtual void Print() override;
+};
diff --git a/week11/Exercise03/Electronics.cpp b/week11/Exercise03/Electronics.cpp
new file mode 100644
index 0000000..73be261
--- /dev/null
+++ b/week11/Exercise03/Electronics.cpp
@@ -0,0 +1,6 @@
+#include "Electronics.h"
+#include <iostream>
+
+void Electroics::Print() {
+ std::cout << model << ' ' << needsVolts << ' ' << needsAmps;
+}
diff --git a/week11/Exercise03/Electronics.h b/week11/Exercise03/Electronics.h
new file mode 100644
index 0000000..9f3d849
--- /dev/null
+++ b/week11/Exercise03/Electronics.h
@@ -0,0 +1,10 @@
+#pragma once
+
+class Electroics {
+ char model[256];
+ float needsVolts;
+ float needsAmps;
+
+public:
+ virtual void Print();
+};
diff --git a/week11/Exercise03/Laptop.cpp b/week11/Exercise03/Laptop.cpp
new file mode 100644
index 0000000..5c2ea87
--- /dev/null
+++ b/week11/Exercise03/Laptop.cpp
@@ -0,0 +1,7 @@
+#include "Laptop.h"
+#include <iostream>
+
+void Laptop::Print() {
+ Electroics::Print();
+ std::cout << ' ' << screenSize;
+}
diff --git a/week11/Exercise03/Laptop.h b/week11/Exercise03/Laptop.h
new file mode 100644
index 0000000..19b0bd5
--- /dev/null
+++ b/week11/Exercise03/Laptop.h
@@ -0,0 +1,9 @@
+#pragma once
+#include "Electronics.h"
+
+class Laptop : Electronics {
+ float screenSize;
+
+public:
+ virtual void Print() override;
+};
diff --git a/week11/Exercise03/WashingMachine.cpp b/week11/Exercise03/WashingMachine.cpp
new file mode 100644
index 0000000..18caa5f
--- /dev/null
+++ b/week11/Exercise03/WashingMachine.cpp
@@ -0,0 +1,7 @@
+#include "WashingMachine.h"
+#include <iostream>
+
+void WashingMachine::Print() {
+ Electroics::Print();
+ std::cout << ' ' << maxLaundryWeight;
+}
diff --git a/week11/Exercise03/WashingMachine.h b/week11/Exercise03/WashingMachine.h
new file mode 100644
index 0000000..8915393
--- /dev/null
+++ b/week11/Exercise03/WashingMachine.h
@@ -0,0 +1,9 @@
+#pragma once
+#include "Electronics.h"
+
+class WashingMachine : Electronics {
+ unsigned maxLaundryWeight;
+
+public:
+ virtual void Print() override;
+};