From fb1e53e9f9036db74955cd3b0c7dc30ffb14ec10 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Tue, 4 Apr 2023 13:26:38 +0200 Subject: [PATCH] 'Added some basic python operations in OOP;' --- .gitignore | 2 + cpp/.cproject | 121 +++++++++++++++++++++++++++++++++++ cpp/.gitignore | 1 + cpp/.idea/.gitignore | 8 +++ cpp/.idea/cpp.iml | 2 + cpp/.idea/modules.xml | 8 +++ cpp/.idea/vcs.xml | 6 ++ cpp/.project | 27 ++++++++ cpp/{ => src}/Figure.cpp | 0 cpp/{ => src}/Figure.h | 0 cpp/{ => src}/Square.cpp | 0 cpp/{ => src}/Square.h | 0 cpp/{ => src}/main.cpp | 1 + java/.project | 2 +- python/.project | 17 +++++ python/.pydevproject | 8 +++ python/net/__init__.py | 0 python/net/hypki/Area.py | 18 ++++++ python/net/hypki/Figure.py | 27 ++++++++ python/net/hypki/Main.py | 23 +++++++ python/net/hypki/Square.py | 24 +++++++ python/net/hypki/__init__.py | 0 22 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 cpp/.cproject create mode 100644 cpp/.gitignore create mode 100644 cpp/.idea/.gitignore create mode 100644 cpp/.idea/cpp.iml create mode 100644 cpp/.idea/modules.xml create mode 100644 cpp/.idea/vcs.xml create mode 100644 cpp/.project rename cpp/{ => src}/Figure.cpp (100%) rename cpp/{ => src}/Figure.h (100%) rename cpp/{ => src}/Square.cpp (100%) rename cpp/{ => src}/Square.h (100%) rename cpp/{ => src}/main.cpp (93%) create mode 100644 python/.project create mode 100644 python/.pydevproject create mode 100644 python/net/__init__.py create mode 100644 python/net/hypki/Area.py create mode 100644 python/net/hypki/Figure.py create mode 100644 python/net/hypki/Main.py create mode 100644 python/net/hypki/Square.py create mode 100644 python/net/hypki/__init__.py diff --git a/.gitignore b/.gitignore index ba077a4..3e305ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ bin +python/net/__pycache__ +python/net/hypki/__pycache__ diff --git a/cpp/.cproject b/cpp/.cproject new file mode 100644 index 0000000..0e12f21 --- /dev/null +++ b/cpp/.cproject @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cpp/.gitignore b/cpp/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/cpp/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/cpp/.idea/.gitignore b/cpp/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/cpp/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/cpp/.idea/cpp.iml b/cpp/.idea/cpp.iml new file mode 100644 index 0000000..4c94235 --- /dev/null +++ b/cpp/.idea/cpp.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/cpp/.idea/modules.xml b/cpp/.idea/modules.xml new file mode 100644 index 0000000..e009e75 --- /dev/null +++ b/cpp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/cpp/.idea/vcs.xml b/cpp/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/cpp/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/cpp/.project b/cpp/.project new file mode 100644 index 0000000..c50a933 --- /dev/null +++ b/cpp/.project @@ -0,0 +1,27 @@ + + + wmii-prog-obiektowe-cpp + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/cpp/Figure.cpp b/cpp/src/Figure.cpp similarity index 100% rename from cpp/Figure.cpp rename to cpp/src/Figure.cpp diff --git a/cpp/Figure.h b/cpp/src/Figure.h similarity index 100% rename from cpp/Figure.h rename to cpp/src/Figure.h diff --git a/cpp/Square.cpp b/cpp/src/Square.cpp similarity index 100% rename from cpp/Square.cpp rename to cpp/src/Square.cpp diff --git a/cpp/Square.h b/cpp/src/Square.h similarity index 100% rename from cpp/Square.h rename to cpp/src/Square.h diff --git a/cpp/main.cpp b/cpp/src/main.cpp similarity index 93% rename from cpp/main.cpp rename to cpp/src/main.cpp index 6bca32e..d88ee55 100644 --- a/cpp/main.cpp +++ b/cpp/src/main.cpp @@ -17,6 +17,7 @@ int main() { << " has area= " << s.computeArea() << std::endl; + std::cout << "Finished" << std::endl; return 0; } diff --git a/java/.project b/java/.project index dbf6236..cec636a 100644 --- a/java/.project +++ b/java/.project @@ -1,6 +1,6 @@ - wmii-prog-obiektowe + wmii-prog-obiektowe-java diff --git a/python/.project b/python/.project new file mode 100644 index 0000000..498050e --- /dev/null +++ b/python/.project @@ -0,0 +1,17 @@ + + + wmii-prog-obiektowe-python + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/python/.pydevproject b/python/.pydevproject new file mode 100644 index 0000000..c3434da --- /dev/null +++ b/python/.pydevproject @@ -0,0 +1,8 @@ + + + +/${PROJECT_DIR_NAME} + +python 3.0 +Default + diff --git a/python/net/__init__.py b/python/net/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/python/net/hypki/Area.py b/python/net/hypki/Area.py new file mode 100644 index 0000000..3b2b82c --- /dev/null +++ b/python/net/hypki/Area.py @@ -0,0 +1,18 @@ +''' +Created on Apr 4, 2023 + +@author: ahypki +''' + +class Area(): + ''' + classdocs + ''' + + def __init__(self): + ''' + Constructor + ''' + + def compute_area(self): + pass \ No newline at end of file diff --git a/python/net/hypki/Figure.py b/python/net/hypki/Figure.py new file mode 100644 index 0000000..7be47bc --- /dev/null +++ b/python/net/hypki/Figure.py @@ -0,0 +1,27 @@ +''' +Created on Apr 4, 2023 + +@author: ahypki +''' + +class Figure(): + ''' + classdocs + ''' + + __name = ''; + + def __init__(self, newName = 'Default __name'): + ''' + Constructor + ''' + self.__name = newName; + + def get_name(self): + return self.__name + + def set_name(self, value): + self.__name = value + + def __str__(self): + return "Figure with name= {0}".format(self.__name) diff --git a/python/net/hypki/Main.py b/python/net/hypki/Main.py new file mode 100644 index 0000000..ab1c9cb --- /dev/null +++ b/python/net/hypki/Main.py @@ -0,0 +1,23 @@ +''' +Created on Apr 4, 2023 + +@author: ahypki +''' +from net.hypki.Figure import Figure +from net.hypki.Square import Square + +if __name__ == '__main__': + f = Figure() + f.__name = "New name" + + f2 = Figure('Another name') + + print(str(f)) + print(str(f2)) + + s1 = Square('Square1') + print(str(s1)) +# print(str(s1.__name)) # will not work + print(s1.get_name()) + + print('Finished!') \ No newline at end of file diff --git a/python/net/hypki/Square.py b/python/net/hypki/Square.py new file mode 100644 index 0000000..61c63b0 --- /dev/null +++ b/python/net/hypki/Square.py @@ -0,0 +1,24 @@ +''' +Created on Apr 4, 2023 + +@author: ahypki +''' +from net.hypki.Figure import Figure +from net.hypki.Area import Area + +class Square(Figure, Area): + ''' + classdocs + ''' + + def __init__(self, newName): + ''' + Constructor + ''' + super().__init__(newName) + + def __str__(self): + return "Square with name= {0} has area= {1}".format(self.get_name(), self.compute_area()) + + def compute_area(self): + return 4.0 \ No newline at end of file diff --git a/python/net/hypki/__init__.py b/python/net/hypki/__init__.py new file mode 100644 index 0000000..e69de29