Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. #include<iostream>
  2. #include<list>
  3. #include<vector>
  4. #include<string>
  5. #include<cstdlib>
  6. #include <cstddef>
  7.  
  8. using namespace std;
  9.  
  10. class Towar {
  11. protected:
  12. string cena;
  13. string nazwa;
  14. string opis;
  15. public:
  16.  
  17. Towar(){}
  18. Towar(float cena, string nazwa, string opis)
  19. {
  20. this->cena=cena;
  21. this->nazwa=nazwa;
  22. this->opis=opis;
  23. }
  24.  
  25. virtual void podsumuj(){};
  26. };
  27.  
  28. class Urzadzenie : public Towar {
  29. protected:
  30. string nazwa_producenta;
  31. public:
  32. int a;
  33. Urzadzenie(string nazwa_producenta,float cena, string nazwa, string opis): Towar(cena, nazwa, opis)
  34. {
  35.  
  36. this->nazwa_producenta=nazwa_producenta;
  37. }
  38. void podsumuj(){
  39. cout<<nazwa_producenta<<" "<<cena<<" "<<nazwa<<" "<<opis<<"\n";
  40. }
  41. };
  42. class Nosnik :public Towar{
  43. protected:
  44. int wielkosc;
  45. public:
  46. Nosnik (int wielkosc, float cena, string nazwa, string opis):Towar(cena,nazwa,opis)
  47. {
  48. this->wielkosc=wielkosc;
  49. }
  50.  
  51. };
  52.  
  53. class Telefon :public Urzadzenie{
  54. protected:
  55. string model;
  56. public:
  57. Telefon(string model,string nazwa_producenta,float cena, string nazwa, string opis):Urzadzenie(nazwa_producenta,cena,nazwa,opis)
  58. {
  59. this->model=model;
  60. }
  61. };
  62. class Smartfon: public Telefon {
  63. protected:
  64. bool barometr;
  65. bool hd;
  66. bool termometr;
  67. public:
  68. Smartfon(bool barometr, bool hd,bool termometr,string model,string nazwa_producenta,float cena, string nazwa, string opis): Telefon(model,nazwa_producenta,cena,nazwa,opis)
  69. {
  70. this->barometr=barometr;
  71. this->hd=hd;
  72. this->termometr=termometr;
  73. }
  74. };
  75. class Dumbfon: public Telefon {
  76. protected:
  77. bool wyswietlacz;
  78. public:
  79. Dumbfon(bool wyswietlacz,string model,string nazwa_producenta,float cena, string nazwa, string opis):Telefon(model,nazwa_producenta,cena,nazwa,opis)
  80. {
  81. this->wyswietlacz=wyswietlacz;
  82. }
  83.  
  84. };
  85.  
  86. class Komputer: public Urzadzenie{
  87. protected:
  88. string model;
  89. public:
  90. Komputer(string model,string nazwa_producenta,float cena, string nazwa, string opis):Urzadzenie(nazwa_producenta,cena,nazwa,opis)
  91. {
  92. this->model=model;
  93. }
  94. };
  95. class Tablet: public Komputer{
  96. protected:
  97. int wyswietlacz;
  98. public:
  99. Tablet(int wyswietlacz,string model,string nazwa_producenta,float cena, string nazwa, string opis):Komputer(model,nazwa_producenta,cena,nazwa,opis)
  100. {
  101. this->wyswietlacz=wyswietlacz;
  102. }
  103. };
  104. class Laptop:public Komputer{
  105. protected:
  106. string system;
  107. public:
  108. Laptop(string system,string model,string nazwa_producenta,float cena, string nazwa):Komputer(model,nazwa_producenta,cena,nazwa,opis)
  109. {
  110. this->system=system;
  111. }
  112. };
  113. class Plyta :public Nosnik{
  114. protected:
  115. string rodzaj_danych;
  116. public:
  117. Plyta(string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Nosnik(wielkosc,cena,nazwa,opis)
  118. {
  119. this->rodzaj_danych=rodzaj_danych;
  120. }
  121.  
  122. };
  123. class Ksiazka:public Nosnik{
  124. protected:
  125. int ilosc_stron;
  126. public:
  127. Ksiazka(int ilosc_stron,int wielkosc, float cena, string nazwa, string opis):Nosnik(wielkosc,cena,nazwa,opis)
  128. {
  129. this->ilosc_stron=ilosc_stron;
  130. }
  131. };
  132. class CD :public Plyta{
  133. protected:
  134. string nazwa1;
  135. public:
  136. CD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
  137. {
  138. this->nazwa1=nazwa1;
  139. }
  140. };
  141. class DVD :public Plyta{
  142. protected:
  143. string nazwa1;
  144. public:
  145. DVD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
  146. {
  147. this->nazwa1=nazwa1;
  148. }
  149.  
  150. };
  151. class BR :public Plyta{
  152. protected:
  153. string nazwa1;
  154. public:
  155. BR(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
  156. {
  157. this->nazwa1=nazwa1;
  158. }
  159.  
  160. };
  161. class AD :public Plyta{
  162. protected:
  163. string nazwa1;
  164. public:
  165. AD(string nazwa1,string rodzaj_danych,int wielkosc, float cena, string nazwa, string opis):Plyta(rodzaj_danych,wielkosc,cena,nazwa,opis)
  166. {
  167. this->nazwa1=nazwa1;
  168. }
  169.  
  170. };
  171.  
  172. class Kontener{
  173. public:
  174. Towar towarKontenera;
  175. int iloscKontenera;
  176. Kontener(){
  177. }
  178. };
  179.  
  180.  
  181. class Magazyn:public Towar {
  182. protected:
  183. string ilosc;
  184. string rzecz;
  185. list < Kontener >::iterator it;
  186. list < Kontener > lista;
  187.  
  188. public:
  189. void dodajTowar(Towar towar, int ilosc){
  190.  
  191. Kontener kontener;
  192.  
  193. kontener.towarKontenera = towar;
  194. kontener.iloscKontenera = ilosc;
  195. lista.push_back(kontener);
  196.  
  197. }
  198.  
  199. void listuj(){
  200.  
  201. for(it=lista.begin(); it!=lista.end(); it++){
  202.  
  203. (*it).towarKontenera;
  204. }
  205.  
  206.  
  207. }
  208.  
  209. };
  210.  
  211.  
  212.  
  213. int main ()
  214. {
  215. Urzadzenie u("nazwa prodcenta", 666, "nazwa", "lala");
  216. Urzadzenie u2("nazwa prodcenta2", 666, "nazwa2", "lala2");
  217. Magazyn magazyn;
  218. magazyn.dodajTowar(u, 5);
  219. //magazyn.dodajTowar(u2, 8);
  220. //magazyn.dodajTowar(u, 4);
  221. //magazyn.dodajTowar(u2, 6);
  222.  
  223. return 0;
  224. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement