From 1287b0deaa4e300524cd3eaee38a6c46230a615f Mon Sep 17 00:00:00 2001 From: marcin Date: Mon, 13 May 2019 14:42:48 +0200 Subject: [PATCH] added java & fixed z7 --- Jerzy/Okno.java | 24 +++++++++ Jerzy/main.java | 13 +++++ Kolokwium 15.04/a.out | Bin 0 -> 28168 bytes Kolokwium 15.04/kolo/geometry/Makefile | 2 + Kolokwium 15.04/kolo/geometry/geometry.cpp | 57 ++++++++++++++++++++ Kolokwium 15.04/kolo/parking/parking.py | 56 +++++++++++++++++++ Kolokwium 15.04/kolo/s444409_kol.zip | Bin 0 -> 1476 bytes Kolokwium 15.04/zad1 | Bin 0 -> 28168 bytes Kolokwium 15.04/zad1.cpp | 57 ++++++++++++++++++++ Kolokwium 15.04/zad2.py | 56 +++++++++++++++++++ POB_Java/Employee.class | Bin 0 -> 1659 bytes POB_Java/Employee.java | 45 ++++++++++++++++ POB_Java/Employee_main.class | Bin 0 -> 479 bytes POB_Java/Employee_main.java | 10 ++++ zad7_1 | Bin 0 -> 18600 bytes zad7_1.cpp | 59 +++++++++++++++++++++ zad7_2.cpp | 34 ++++++++++++ 17 files changed, 413 insertions(+) create mode 100644 Jerzy/Okno.java create mode 100644 Jerzy/main.java create mode 100755 Kolokwium 15.04/a.out create mode 100644 Kolokwium 15.04/kolo/geometry/Makefile create mode 100644 Kolokwium 15.04/kolo/geometry/geometry.cpp create mode 100644 Kolokwium 15.04/kolo/parking/parking.py create mode 100644 Kolokwium 15.04/kolo/s444409_kol.zip create mode 100755 Kolokwium 15.04/zad1 create mode 100644 Kolokwium 15.04/zad1.cpp create mode 100644 Kolokwium 15.04/zad2.py create mode 100644 POB_Java/Employee.class create mode 100644 POB_Java/Employee.java create mode 100644 POB_Java/Employee_main.class create mode 100644 POB_Java/Employee_main.java create mode 100755 zad7_1 create mode 100644 zad7_1.cpp create mode 100644 zad7_2.cpp diff --git a/Jerzy/Okno.java b/Jerzy/Okno.java new file mode 100644 index 0000000..4fbef0e --- /dev/null +++ b/Jerzy/Okno.java @@ -0,0 +1,24 @@ +package POB_2019.Jerzy; + +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JButton; +import java.awt.*; + +public class Okno extends JFrame { + public Okno(){ + super("Moje okno"); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setPreferredSize(new Dimension(500,500)); + setLocation(100,100); + setVisible(true); + } + @Override + public void paintComponents(Graphics g){ + super.paintComponents(g); + Graphics g2 = (Graphics2D) g; + g2.drawOval(10,10, 490, 490); + g2.drawRect(100,100, 400, 400); + setVisible(true); + } +} \ No newline at end of file diff --git a/Jerzy/main.java b/Jerzy/main.java new file mode 100644 index 0000000..265d671 --- /dev/null +++ b/Jerzy/main.java @@ -0,0 +1,13 @@ +package POB_2019.Jerzy; + +import java.awt.EventQueue; + +public class main { + public static void main (String[] args){ + EventQueue.invokeLater(new Runnable(){ + public void run(){ + new Okno(); + } + }); + } +} \ No newline at end of file diff --git a/Kolokwium 15.04/a.out b/Kolokwium 15.04/a.out new file mode 100755 index 0000000000000000000000000000000000000000..1fd335c0c312a2b650cfc3a36fe976de576c30b5 GIT binary patch literal 28168 zcmeHQ3v^V~xjuP8w2(vujbdSZVL*wQya+0q*T9J+F_MHLf`=h9Nk)@QoJ>N((v~(> z88H@JR#|Gj^l@FZw^vzhZx^*zgQ!94va$EpQniW}b)tApeWsQ=_xtz$_c>=yW&qoJ z*IoCn9G(1U|F8Y;fB*a6`@A+^^VBX+O-a$zk)~a$QK{f0i797--pVHcNs@@P+uhnb8|10=a!On1UFm`_1vAwiN$cI0MBih^2>ER$RYopRX; zOBk=9qMP*nC@R+%U@xvz&rC>@NkC zKS>S!o@BZcR)a=|g2YQl!<%6romX?aobU)cUO^>yCFID?<2|@}+A6LunO`Q@eg(OD z?ZS@0#?s;oJA8{f0$siRi~Gw;7nc_2_XP6`MY~Bq@vf+E7ABEJBdAWlkm?;f`2VZz4s^KKMnOJYHxEA zd-f&4Ka)g%dJ_Kmu+xQ~^B7E`=Q~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d1ok@v-J zcX1VpPKj%=^7t3;DsvM<+KaHa%gS*+5xg=rxe>~eCXw-BT!h#{5F;qd4D7b}cZCd6 ztjYw(6K^*5#&8k#|EmcEJoc!xva+n2rFmr_c zZT^rLC+9lwo;}M^Fo5jKQ2A8ry9f9L$rHfl6uZwY7!>j+h!A9 z1j$rkpOI}m2yyN1~$a^nizqq*WAZkBbAxn zqXm*!93d;k?PQE<6C`GL+2k>Mj3FiW&u!`H71IOx&wfRL2y-q+kC{t-e34;G$;p#b z+;XsiTZ& z$50k=X>=arx*^H*Lur;~>moyBSZtnsoT09kpT~@At0{5U0Dn&eba#uf)YNFshcFh+ zM?{#@TnqMfZVQIuGd@;xNiLU{OcJC;skrub4mPoDKH5g+aT`#hyLrQC>T0$9c3gTy z=Za0HX^_xe8uGkIh;dgd|LCwOrfW&HYDgY&a>{e=dOayR?s35&q#wgp~*rIsYG5KC)78XTwTf!o_Fa zN!OT~mfthb8TM`j42L9aS7&tb66)6SyKuRakDbRC)4E!gaE~W{V{ZWeW<|iK{oa5u}7{p5RPKcltHj92pNeKrNv`VXGCe$1k%lj0`=ie28tatfONJ_l=XsMqdt$gAh>3Vy5}@HphTsNL(3&vQwN zf_R)6cTgYLkDVxx{mTF9{TT(7UzLpVpDOQi$gB7K6jc9ykm7gN|8s}DdLK~121kXC zqBiW1SMLofsGb+8`Z*j_QTr{<$i*~<=uq!zseh+P^_Qet@uTc`6$Cu`H09NMh`Gz8 zgyKsk{|*Rbld9i*-p%qml^{c>zE6Rt*j4hwb&^s2J5uW3i&F8eAI`JQCC6xm@)$`d80V3tE(y&tfH<<&S>YLuKR&xSnV%=R}(%I +#include +#include +#include +using namespace std; + +class Geometry { + public: + virtual string type()=0; + virtual float volume()=0; +}; + +class Box : public Geometry { + private: + int dimX, dimY, dimZ; + public: + Box(int _dimX, int _dimY, int _dimZ){ + dimX=_dimX; + dimY=_dimY; + dimZ=_dimZ; + } + virtual string type(){ + return "Box"; + } + virtual float volume(){ + return(dimX*dimZ*dimY); + } +}; + +class Ball : public Geometry { + private: + int radius; + public: + Ball(int _radius){ + radius=_radius; + } + virtual string type(){ + return "Ball"; + } + virtual float volume(){ + return (float)4/3*M_PI*pow(radius, 3); + } +}; + +int main() +{ + vector geometries = { + (Geometry*)new Box(10, 2, 3), + (Geometry*)new Box(3, 3, 1), + (Geometry*)new Ball(5), + (Geometry*)new Ball(1) + }; + for (Geometry *f : geometries) { + cout << f->type() << ": volume = " << f->volume() << "\n"; + } + return 0; +} \ No newline at end of file diff --git a/Kolokwium 15.04/kolo/parking/parking.py b/Kolokwium 15.04/kolo/parking/parking.py new file mode 100644 index 0000000..ec0f496 --- /dev/null +++ b/Kolokwium 15.04/kolo/parking/parking.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +class Owner(): + def __init__(self, _name, _surname): + self.name=_name + self.surname=_surname + def __str__(self): + return "%s %s" % (self.name, self.surname) + +class Car(Owner): + def __init__(self, _brand, _owner): + self.brand=_brand + self.owner=_owner + def __str__(self): + return "%s, %s %s" % (self.brand, self.owner.name, self.owner.surname) + +class Parking(Car): + def __init__(self, _parkingSpaces): + self.cars=[] + self.parkingSpaces=_parkingSpaces + def addCar(self, car): + if len(self.cars)>=self.parkingSpaces: + return; + else: + self.cars.append(car) + def removeCar(self, selectedCar): + if selectedCar in self.cars: + self.cars.remove(selectedCar) + def count(self): + return str(len(self.cars)) + def freePlaces(self): + return str(self.parkingSpaces-len(self.cars)) + def __str__(self): + sStream='' + sStream=sStream + str(len(self.cars)) + ' cars:\n' + for car in self.cars: + sStream=sStream + str(car) + '\n' + return sStream +parking = Parking(3) + +owner1 = Owner("Jan", "Sienkiewicz") +owner2 = Owner("Marek", "Kowalski") + +car1 = Car("Renault", owner1) +car2 = Car("BMW", owner2) +car3 = Car("Opel", owner1) +car4 = Car("Mercedes", owner1) + +parking.addCar(car1) +parking.addCar(car2) +parking.addCar(car3) +parking.addCar(car4) +parking.removeCar(car3) +parking.addCar(car4) + +print(parking) \ No newline at end of file diff --git a/Kolokwium 15.04/kolo/s444409_kol.zip b/Kolokwium 15.04/kolo/s444409_kol.zip new file mode 100644 index 0000000000000000000000000000000000000000..aee2bbcdf4af48e94509ca4f75352cd6bee4575d GIT binary patch literal 1476 zcmWIWW@Zs#0D<6=em^h+N^k<{^wj*^)RLk~{Q$5sCI$|M6*>KW@3S}S>jI?>fmje( znQvltYFcJas<;2y^S-*8tF{Drv~T({iJNPO#pSJAMN3M%y@PTlZ{5o4D-x0;Qu0|e zL}mvA!fXwo6FlF<#!X^mU?^r`U=T$%8|D_h}$4V+Ij7( zyWixQcB{88jJaaLZp?cm&sV10j*qQPCq3eX_UYG)Hp<*m?0>_Z=KKDji=TPKggg~p z)+JjiK3|o4Y0G!6ZE~*c(>ST$A0WiMK-Y{BKySDXU`I7Q=?Tdq|wYqL8ZNIAd zb=~`gCvE=M$szN$@O}RBd#68ry&1iEZStX?2C@Rd{9y@ER(iLTPyf+*C^&O_!&J+l zpo1|&TXdG|?oz$^>U_S@w}*bF-_KuPzUkTFCpnP^Yj;G<+;L)(=GvaZjMooRKfNtG z7&BKpachG?%bT=Bj@8|^*%2o{lm*)!y8QKf(4%d9C$b)_wErdzi9}$0VWcAtpjbg- zQFdltI#M!H1xEE#Q={;Qz^J~?%D^CmqzbB9ub{FwBpynC-mH~%s51NMP` z*Z++E7%GygI#tM4-hyM!9XAhKOA!rU$#maYNt~&M&YH`u1KRI!|6MQq%KdY3@5C_S zM|03q2O%)dY`u9-!ixofgc5nW2+weePuzpC6q}$Flh7t6zl{EaKrD4by}86IFhcB!xf! zb53XW9TTP(eLl<81Iic4JC|yeblsZy=aJr)6)kMX+src7t@pJ46<0gkO`7NRZGJonm>?LL?3r;FK%fK#0&g8bB&-O4Yr|C_ffR#4L!&y7glmHp zPcU0S+Od^6V7*}N&B)qe=735dm=PeQ=p`p8#lyf`M-L|C^bhea$YN|c0H&* YB0mIpv$BEIumYhzFz3_*3rPkB02v22&j0`b literal 0 HcmV?d00001 diff --git a/Kolokwium 15.04/zad1 b/Kolokwium 15.04/zad1 new file mode 100755 index 0000000000000000000000000000000000000000..1fd335c0c312a2b650cfc3a36fe976de576c30b5 GIT binary patch literal 28168 zcmeHQ3v^V~xjuP8w2(vujbdSZVL*wQya+0q*T9J+F_MHLf`=h9Nk)@QoJ>N((v~(> z88H@JR#|Gj^l@FZw^vzhZx^*zgQ!94va$EpQniW}b)tApeWsQ=_xtz$_c>=yW&qoJ z*IoCn9G(1U|F8Y;fB*a6`@A+^^VBX+O-a$zk)~a$QK{f0i797--pVHcNs@@P+uhnb8|10=a!On1UFm`_1vAwiN$cI0MBih^2>ER$RYopRX; zOBk=9qMP*nC@R+%U@xvz&rC>@NkC zKS>S!o@BZcR)a=|g2YQl!<%6romX?aobU)cUO^>yCFID?<2|@}+A6LunO`Q@eg(OD z?ZS@0#?s;oJA8{f0$siRi~Gw;7nc_2_XP6`MY~Bq@vf+E7ABEJBdAWlkm?;f`2VZz4s^KKMnOJYHxEA zd-f&4Ka)g%dJ_Kmu+xQ~^B7E`=Q~OCypV*S;?d<)j&fxZJr^h8KMZ`Ler!a&Cuyf^ z!ws^M9OxAX#z{}u*K+>(G&V{#!)WUab{RckZzyaSno-kKXZZXfe_Nm@><=~7Rdocr z{7v4C9eznmOj+9)?&zs$X$-sFE$!Zr5e|6+VIVw>Ui|T_0-f=;el?y5$I|S5?8&bvfAzG6NPYDAlPF-tG~FWD-f1=qpiQ+==O(tf?eK@ zKzP9DE10am5Owtg5>x?Gy+(I$$ZzxoLg8L-hpZ?`8 z4JL_^^L)f9#5-=DC?8~)*akLrM8w9qlYkV&1ml06zK99tNcB^oqi&=s8~c8 zwp?elv|nemdIRvQaJ4t=?+-w^D6|Hs%QpM9PJd@-un$pbkOB_iPH&(~TTxYI6y+Ca zD{5;htBk_@!u%5RyjZJRv!#+m0?jDzn)FodPNo-te|8`+ zQ`4qvpE6GJr`h<^pwU{k{QJY#!K@4|1(O-saQ(zRkWANRa5=p2PAmyhwYfCe;V{=7 z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j42L9aS7&tb66)6SyKuRakDbRC)4E!gaE~W{V{ZWeW<|iK{oa5u}7{p5RPKcltHj92pNeKrNv`VXGCe$1k%lj0`=ie28tatfONJ_l=XsMqdt$gAh>3Vy5}@HphTsNL(3&vQwN zf_R)6cTgYLkDVxx{mTF9{TT(7UzLpVpDOQi$gB7K6jc9ykm7gN|8s}DdLK~121kXC zqBiW1SMLofsGb+8`Z*j_QTr{<$i*~<=uq!zseh+P^_Qet@uTc`6$Cu`H09NMh`Gz8 zgyKsk{|*Rbld9i*-p%qml^{c>zE6Rt*j4hwb&^s2J5uW3i&F8eAI`JQCC6xm@)$`d80V3tE(y&tfH<<&S>YLuKR&xSnV%=R}(%I +#include +#include +#include +using namespace std; + +class Geometry { + public: + virtual string type()=0; + virtual float volume()=0; +}; + +class Box : public Geometry { + private: + int dimX, dimY, dimZ; + public: + Box(int _dimX, int _dimY, int _dimZ){ + dimX=_dimX; + dimY=_dimY; + dimZ=_dimZ; + } + virtual string type(){ + return "Box"; + } + virtual float volume(){ + return(dimX*dimZ*dimY); + } +}; + +class Ball : public Geometry { + private: + int radius; + public: + Ball(int _radius){ + radius=_radius; + } + virtual string type(){ + return "Ball"; + } + virtual float volume(){ + return (float)4/3*M_PI*pow(radius, 3); + } +}; + +int main() +{ + vector geometries = { + (Geometry*)new Box(10, 2, 3), + (Geometry*)new Box(3, 3, 1), + (Geometry*)new Ball(5), + (Geometry*)new Ball(1) + }; + for (Geometry *f : geometries) { + cout << f->type() << ": volume = " << f->volume() << "\n"; + } + return 0; +} \ No newline at end of file diff --git a/Kolokwium 15.04/zad2.py b/Kolokwium 15.04/zad2.py new file mode 100644 index 0000000..ec0f496 --- /dev/null +++ b/Kolokwium 15.04/zad2.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 + +class Owner(): + def __init__(self, _name, _surname): + self.name=_name + self.surname=_surname + def __str__(self): + return "%s %s" % (self.name, self.surname) + +class Car(Owner): + def __init__(self, _brand, _owner): + self.brand=_brand + self.owner=_owner + def __str__(self): + return "%s, %s %s" % (self.brand, self.owner.name, self.owner.surname) + +class Parking(Car): + def __init__(self, _parkingSpaces): + self.cars=[] + self.parkingSpaces=_parkingSpaces + def addCar(self, car): + if len(self.cars)>=self.parkingSpaces: + return; + else: + self.cars.append(car) + def removeCar(self, selectedCar): + if selectedCar in self.cars: + self.cars.remove(selectedCar) + def count(self): + return str(len(self.cars)) + def freePlaces(self): + return str(self.parkingSpaces-len(self.cars)) + def __str__(self): + sStream='' + sStream=sStream + str(len(self.cars)) + ' cars:\n' + for car in self.cars: + sStream=sStream + str(car) + '\n' + return sStream +parking = Parking(3) + +owner1 = Owner("Jan", "Sienkiewicz") +owner2 = Owner("Marek", "Kowalski") + +car1 = Car("Renault", owner1) +car2 = Car("BMW", owner2) +car3 = Car("Opel", owner1) +car4 = Car("Mercedes", owner1) + +parking.addCar(car1) +parking.addCar(car2) +parking.addCar(car3) +parking.addCar(car4) +parking.removeCar(car3) +parking.addCar(car4) + +print(parking) \ No newline at end of file diff --git a/POB_Java/Employee.class b/POB_Java/Employee.class new file mode 100644 index 0000000000000000000000000000000000000000..ed1893a22afa5c5939a903a2f208658631e00882 GIT binary patch literal 1659 zcmaJ>T~`}b6y1}r8NviGHP8mFDFvE_7PM;7hFVKfEE;GvXdisKBzM7-%uLqIP1njV zu@5d^eb!ZUtvvVx{829VoeU(D=tIuUId`A4&)3|){~7!RU=uI0m_vCAv$(BAMT<2p z?o8n>*7F42%i?2vl81r&c_eTzk0d^~@W4XV!j_4LCcZF`@`Ni5Gy(`+;MaQxijdxF5bpfEZKMmc^g;ou8o5JH;)Aq zk8FI2#|GxMeP4wt5Zyhgj{SBxo58k)nvFW1nAoxL6|Px$s`Xt9Ut9P_|7{ppY|57J zwM(oh%Df~+;DsgE59GRm;*Jx9>OU@5wtaPceiufbC3P%IAtzT7uIu+a#UR#MHOzA~ z%x8x$WlLQ!HT$8GE_>(qcu^Qm&G9#$>(+AkQn=MD_OQyEumgG z>X`pRB|H@xSe-QX%bQ@}N|e+^9*!;=Xop*s<}PTe0=Hq3e{O6yG|n2X#?Ylc!NtTg z-TkJ4$E%EE40qtE z@Y)?2E)N~6mop!;TyQ+-cjW~5k7M}Z@T%jr#UW~<(`hcR&gKDMTl~hUnx6!85~W?HitB`VAkh6BRn}$Z{rKZ&lCRvO6T#D5qqX` z>lEp?@kQbniM)ZO7%z!7nC-*gk*T~vVgM8P1J+PY4p_iQO$}JpNKFq|pjJmT^CSS% znPo!PNpqJ(TewMzn^=x1JvK(SZgcGo(&SA4^b2Olm$w<}S1g^GU;jKb=OXj8M$E)y ziKx#-&IDLthgUhFTcjvsos+qbJG6qSBp2pQ7Pv|!LBMxBv&`Z-4)85oyg|LlY(Avz Nqey-l$<0W9_Adnxa1;Ol literal 0 HcmV?d00001 diff --git a/POB_Java/Employee.java b/POB_Java/Employee.java new file mode 100644 index 0000000..3e008c4 --- /dev/null +++ b/POB_Java/Employee.java @@ -0,0 +1,45 @@ +import java.io.*; +public class Employee { + + String name; + int age; + String designation; + double salary; + + // This is the constructor of the class Employee + public Employee(String name) { + this.name = name; + } + + // Assign the age of the Employee to the variable age. + public void empAge(int empAge) { + age = empAge; + } + + /* Assign the designation to the variable designation.*/ + public void empDesignation(String empDesig) { + designation = empDesig; + } + + /* Assign the salary to the variable salary.*/ + public void empSalary(double empSalary) { + salary = empSalary; + } + + /* Print the Employee details */ + public void printEmployee() { + System.out.println("Name:"+ name ); + System.out.println("Age:" + age ); + System.out.println("Designation:" + designation ); + System.out.println("Salary:" + salary); + } + public void compare(Employee emp){ + if(emp.salary > this.salary){ + System.out.println("Second employee earns more."); + } else if (emp.salary < this.salary){ + System.out.println("First employee earns more."); + } else { + System.out.println("Both employees earn the same ammount."); + } + } +} \ No newline at end of file diff --git a/POB_Java/Employee_main.class b/POB_Java/Employee_main.class new file mode 100644 index 0000000000000000000000000000000000000000..e161e471b4b5fcf7e4374f242d1fa036f673805a GIT binary patch literal 479 zcmZutO-lk%6g^kRnQ_uIQ!C9%3z|}L*`f%ckJVTUC5RUBv_VGZLq-kkkF@GP)S`rf zen3Aex=)Zcy$AQ>oO{o`-0z={F93(wF_1)F!-|eo0}-sLji&)KK%BFJj-uLlewhK1 zUe{34ut89d9p4$95TfSZH9~-w0EjlhEiYFYOkT-9wzIYIISNOep zYZN+u??^TptzaB>?F&a1XU@HW8%%8bPIev0h6EOoBIt95CpSgdb$m%|Ca{GvL+!v5 z!^Z?F*d`?BwKEk$`fu=6r*C&hgq->RHtJBgBAgKDjG%P`Zy-Y6D`{GDOtwrS2v?1_DBe+qi#fUv|?oq@y$&0v{hS=vUFKVW_$a+8Tpp;*-{VsFr9fX+a( jmPMR_YV92he`*ER1NRzGSUrX!=M`w!Wqm@Hxd?K<4Y64C literal 0 HcmV?d00001 diff --git a/POB_Java/Employee_main.java b/POB_Java/Employee_main.java new file mode 100644 index 0000000..b05038b --- /dev/null +++ b/POB_Java/Employee_main.java @@ -0,0 +1,10 @@ +public class Employee_main{ + public static void main(String []args){ + Employee emp1=new Employee("Marcin"); + emp1.salary=1500; + Employee emp2=new Employee("Tomasz"); + emp2.salary=1900; + emp1.compare(emp2); + + } +} \ No newline at end of file diff --git a/zad7_1 b/zad7_1 new file mode 100755 index 0000000000000000000000000000000000000000..c9c2160cd1ebaf77afda0fff0cb3db680a68745c GIT binary patch literal 18600 zcmeHPe{@sVeZR5{Ho?e-;FXXiC<$Z`ieeiBCK*98mU%7)T+5~o2|R=(+d9~iXFVl` z!RpLSit0FHS+X&)M8~EQOkqWXm>^a?-9%dRUjPcG{k}fo5(BXrJ$W z_bWd=OWA18&dDFT9O-+%KkxT`?|t`OUEeRC^fxyaIUItEQ#>FfHs7Rp6=S)NC4}&b zIx!dDw~O1vY>@ zsH$)~Y%ek87&1T8p4;RL8+=>&&(Nwzu^C-u>Wyy5hEqy!5qC!UMP$-DrSwiIJ%$xZ zk0HmC%+TkY;@e>ZcvKjYER~iY7-6cHxe1#I51M4bko7(eJ@WJaS~%>js=a)1*`xet zNb#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z ze=#x;iu4&e+{fZ5ZJ2K_(+1bkRIoQ1f=V3L@#T?Cn&vUjga_}@Uc4J~yw7ixMCWJN zQsFm_S@=AHA)lWqwv^>M!MpIGGb`5Ta|?z`Nyt*L-ODO#fm!wWe1oAoOPYS`Wf$6q z;mSsw+vjr-hTJ~yr+DAbR<@x+XL_v9=Y9;AD+abhvhS?V=Wjbe$JRWf&*v%(`P>j9 zvQVt8Wj7EyqvQ7Z{DmR15@ccjS&rd8aOupCaXzPEctq)w|Kun8ugKy6Dil-J=kpwf zeD28Yvp)C#Q%b*H8RTJ>0*zuq{>j4UKnn8tF0;v3Ye@mI>bsR5!%J3S z)NSU)Gd6wxy~NO;am+Nt`fT=?O`p%D7~&ULR{jY*))#vjthCKh-29F=(XKea>ZpQFF7F3YhvX<9?(7i62n^gGxg8v^5 zd%U@QhTnq@P9-w>d=7VV6>-3;1q}3WkEU~$)!KvYf4nw6l|#YA6fhRIRF3v literal 0 HcmV?d00001 diff --git a/zad7_1.cpp b/zad7_1.cpp new file mode 100644 index 0000000..7dced9e --- /dev/null +++ b/zad7_1.cpp @@ -0,0 +1,59 @@ +#include +#include +#include + +using namespace std; + +class Vec2 { + private: + int x,y; + public: + Vec2(int _x, int _y){ + x=_x; + y=_y; + } + string toString(){ + stringstream s; + s << "[" << x << ", " << y << "]"; + return s.str(); + } + friend Vec2 operator+(const Vec2& vec1, const Vec2& vec2){ + return Vec2(vec1.x+vec2.x, vec1.y+vec2.y); + } + friend Vec2 operator-(const Vec2& vec1, const Vec2& vec2){ + return Vec2(vec1.x-vec2.x, vec1.y-vec2.y); + } + Vec2& operator+=(const Vec2& vec){ + x=vec.x+x; + y=vec.y+y; + return *this; + } + Vec2& operator-=(const Vec2& vec){ + x=vec.x-x; + y=vec.y-y; + return *this; + } + friend float operator*(const Vec2& vec1, const Vec2& vec2){ + return (float)vec1.x*vec2.x + (float)vec1.y+vec2.y; + } + bool operator==(const Vec2& vec){ + if(x==vec.x && y==vec.y) return 1; + else return 0; + } + bool operator!=(const Vec2& vec){ + if(x==vec.x && y==vec.y) return 0; + else return 1; + } +}; + +int main(){ + Vec2 vec1 = Vec2(5,1); + Vec2 vec2 = Vec2(3,4); + Vec2 vec3 = vec1 + vec2; + cout << vec3.toString() << endl; + vec3+=vec2; + cout << vec3.toString() << endl; + vec3-=vec1; + cout << vec3.toString() << endl; + cout << vec3*vec2 << endl; +} \ No newline at end of file diff --git a/zad7_2.cpp b/zad7_2.cpp new file mode 100644 index 0000000..60aa8f7 --- /dev/null +++ b/zad7_2.cpp @@ -0,0 +1,34 @@ +#include +#include +#include + +using namespace std; + +template +class Vec2 { + private: + num x,y; + public: + Vec2(num _x, num _y){ + x=_x; + y=_y; + } + string toString(){ + stringstream s; + s << "[" << x << ", " << y << "]"; + return s.str(); + } + Vec2 add(const Vec2& vec){ + return Vec2(x+vec.x, y+vec.y); + } + num multiply(const Vec2& vec){ + return (float)x*vec.x + (float)y*vec.y; + } +}; + +int main(){ + Vec2 vec1 = Vec2(5.5f,1.2f); + Vec2 vec2 = Vec2(3.4f,4.2f); + Vec2 vec3 = vec1.add(vec2); + cout << vec3.toString() << endl; +} \ No newline at end of file