Ahmet_Durmic

Kasa,Racuni[FINISHED]

Jul 29th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.20 KB | None | 0 0
  1. #include<iostream>
  2. #include<string>
  3. #include<iomanip>
  4. #include<chrono>
  5. #include<fstream>
  6. #include<algorithm>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. class I_SlatkiKutak {
  12. public:
  13. I_SlatkiKutak() :
  14. amount{ 4 }, ime{ nullptr }, cijena{ nullptr }{}
  15. virtual ~I_SlatkiKutak() {
  16. delete[] ime; ime = nullptr;
  17. delete[] cijena; cijena = nullptr;
  18. }
  19.  
  20. virtual void print_SlatkiKutak()const = 0;
  21.  
  22. virtual int get_amount()const { return amount; }
  23. virtual string get_imeSlatkisa(const int &i)const = 0;
  24. virtual double get_cijenaSlatkisa(const int &i)const = 0;
  25.  
  26. I_SlatkiKutak&operator=(const I_SlatkiKutak &that);
  27. protected:
  28. int amount;
  29. string *ime;
  30. double *cijena;
  31. };
  32. I_SlatkiKutak&I_SlatkiKutak::operator=(const I_SlatkiKutak &that) {
  33. if (this == &that) {
  34. return *this;
  35. }
  36. amount = that.amount;
  37. ime = new string[amount];
  38. copy(that.ime, that.ime + that.amount, ime);
  39. cijena = that.cijena;
  40. return *this;
  41. }
  42. class I_Drinks {
  43. public:
  44. I_Drinks() :
  45. amount{ 0 }, ime{ nullptr }, cijena{ nullptr }{}
  46. virtual ~I_Drinks() {
  47. delete[] ime; ime = nullptr;
  48. delete[] cijena; cijena = nullptr;
  49. }
  50.  
  51.  
  52. virtual void print_drinks()const = 0;
  53.  
  54. virtual string get_ime_pica(const int &i)const = 0;
  55. virtual double get_cijena(const int &i)const = 0;
  56.  
  57. I_Drinks&operator=(const I_Drinks &that);
  58.  
  59. protected:
  60. int amount;
  61. string *ime;
  62. double *cijena;
  63. };
  64. I_Drinks&I_Drinks::operator=(const I_Drinks &that) {
  65. if (this == &that) {
  66. return *this;
  67. }
  68. amount = that.amount;
  69. ime = new string[amount];
  70. copy(that.ime, that.ime + that.amount, ime);
  71. cijena = that.cijena;
  72. return *this;
  73. }
  74.  
  75. class Slatkisi:public I_SlatkiKutak {
  76. public:
  77. Slatkisi() {
  78. ime = new string[amount];
  79. cijena = new double[amount];
  80. ime[0] = " Palacinci "; cijena[0] = 4.50;
  81. ime[1] = " Waffle "; cijena[1] = 4.50;
  82. ime[2] = " Rafaelo Torta "; cijena[2] = 3.50;
  83. ime[3] = " Tiramisu "; cijena[3] = 3.50;
  84. }
  85. ~Slatkisi() {
  86. delete[] ime; ime = nullptr;
  87. delete[] cijena; cijena = nullptr;
  88. }
  89. void print_SlatkiKutak()const override {
  90. cout << " ----------------------------------- \n";
  91. cout << "| SLATKI KUTAK |\n ";
  92. cout << " ----------------------------------- \n";
  93. for (int i = 0; i < amount; i++) {
  94. cout << "|" << "[" << i + 1 << "] " << get_imeSlatkisa(i) << " | " << get_cijenaSlatkisa(i) << " KM " << setw(5) << "|" << endl;
  95. cout << " ----------------------------------- \n";
  96. }
  97. cout << "Unesite[1,2,3,4]za dodavanje na racun\n";
  98. cout << "-------------------------------------\n";
  99. cout << " Unesite 0 za povratak na MENU\n";
  100. cout << "-------------------------------------\n";
  101. }
  102. int get_amount()const { return amount; }
  103. string get_imeSlatkisa(const int &i)const override { return ime[i]; }
  104. double get_cijenaSlatkisa(const int &i)const override{ return cijena[i]; }
  105.  
  106. Slatkisi&operator=(const Slatkisi &that);
  107. };
  108. Slatkisi&Slatkisi::operator=(const Slatkisi &that) {
  109. if (this == &that) {
  110. return *this;
  111. }
  112. amount = that.amount;
  113. ime = new string[amount];
  114. copy(that.ime, that.ime + that.amount, ime);
  115. cijena = that.cijena;
  116. return *this;
  117. }
  118. class AlkoholnaPica :public I_Drinks {
  119. public:
  120. AlkoholnaPica() {
  121. amount = 4;
  122. ime = new string[amount];
  123. cijena = new double[amount];
  124. ime[0] = " Heineken 0.3 "; cijena[0] = 3.50;
  125. ime[1] = " Desperados 0.5 "; cijena[1] = 3.50;
  126. ime[2] = "Trojka Vodka 0.02"; cijena[2] = 4.50;
  127. ime[3] = "Jack Daniels 0.02"; cijena[3] = 5.50;
  128. }
  129. ~AlkoholnaPica() {
  130. delete[] ime; ime = nullptr;
  131. delete[]cijena; cijena = nullptr;
  132. }
  133.  
  134.  
  135. void print_drinks()const override {
  136. cout << " ----------------------------------- \n";
  137. cout << "| ALKOHOLNA PICA |\n ";
  138. cout << " ----------------------------------- \n";
  139. for (int i = 0; i < amount; i++) {
  140. cout << "|" << "[" << i + 1 << "] " << get_ime_pica(i) << " | " << get_cijena(i) << " KM " << setw(5) << "|" << endl;
  141. cout << " ----------------------------------- \n";
  142. }
  143. cout << "Unesite[1,2,3,4]za dodavanje na racun\n";
  144. cout << "-------------------------------------\n";
  145. cout << " Unesite 0 za povratak na MENU\n";
  146. cout << "-------------------------------------\n";
  147. }
  148.  
  149. int get_amount()const { return amount; }
  150. string get_ime_pica(const int &i)const override { return ime[i]; }
  151. double get_cijena(const int &i)const override { return cijena[i]; }
  152.  
  153. AlkoholnaPica&operator=(const AlkoholnaPica&that);
  154.  
  155. };
  156. AlkoholnaPica&AlkoholnaPica::operator=(const AlkoholnaPica &that) {
  157. if (this == &that) {
  158. return *this;
  159. }
  160. amount = that.amount;
  161. ime = new string[amount];
  162. copy(that.ime, that.ime + that.amount, ime);
  163. cijena = that.cijena;
  164. return *this;
  165. }
  166. class TopliNapici : public I_Drinks {
  167. public:
  168. TopliNapici() {
  169. amount = 4;
  170. ime = new string[amount];
  171. cijena = new double[amount];
  172. ime[0] = " Espresso "; cijena[0] = 1.50;
  173. ime[1] = " Cappuccino "; cijena[1] = 2.50;
  174. ime[2] = "Topla Cokolada"; cijena[2] = 2.50;
  175. ime[3] = " Caj "; cijena[3] = 1.50;
  176. }
  177. ~TopliNapici() {
  178. delete[] ime; ime = nullptr;
  179. delete[]cijena; cijena = nullptr;
  180. }
  181.  
  182.  
  183. void print_drinks()const override {
  184. cout << " ----------------------------------- \n";
  185. cout << "| TOPLI NAPICI |\n ";
  186. cout << " ----------------------------------- \n";
  187. for (int i = 0; i < amount; i++) {
  188. cout << "|" << "[" << i + 1 << "] " << get_ime_pica(i) << " | " << get_cijena(i) << " KM " << setw(5) << "|" << endl;
  189. cout << " ----------------------------------- \n";
  190. }
  191. cout << "Unesite[1,2,3,4]za dodavanje na racun\n";
  192. cout << "-------------------------------------\n";
  193. cout << " Unesite 0 za povratak na MENU\n";;
  194. cout << "-------------------------------------\n";
  195. }
  196.  
  197. int get_amount()const { return amount; }
  198. string get_ime_pica(const int &i)const override { return ime[i]; }
  199. double get_cijena(const int &i)const override { return cijena[i]; }
  200.  
  201. TopliNapici&operator=(const TopliNapici &that);
  202.  
  203. };
  204. TopliNapici&TopliNapici::operator=(const TopliNapici &that) {
  205. if (this == &that) {
  206. return *this;
  207. }
  208. amount = that.amount;
  209. ime = new string[amount];
  210. copy(that.ime, that.ime + that.amount, ime);
  211. cijena = that.cijena;
  212. return *this;
  213. }
  214. class BezalkoholniNapici : public I_Drinks {
  215. public:
  216. BezalkoholniNapici() {
  217. amount = 4;
  218. ime = new string[amount];
  219. cijena = new double[amount];
  220. ime[0] = " Coca Cola "; cijena[0] = 2.50;
  221. ime[1] = " Fanta "; cijena[1] = 2.50;
  222. ime[2] = " Schweppes "; cijena[2] = 2.50;
  223. ime[3] = " Sprite "; cijena[3] = 2.50;
  224. }
  225. ~BezalkoholniNapici() {
  226. delete[] ime; ime = nullptr;
  227. delete[]cijena; cijena = nullptr;
  228. }
  229.  
  230.  
  231. void print_drinks()const override {
  232. cout << " ----------------------------------- \n";
  233. cout << "| BEZALKOHOLNA PICA |\n ";
  234. cout << " ----------------------------------- \n";
  235. for (int i = 0; i < amount; i++) {
  236. cout << "|" << "[" << i + 1 << "] " << get_ime_pica(i) << " | " << get_cijena(i) << " KM " << setw(5) << "|" << endl;
  237. cout << " ----------------------------------- \n";
  238. }
  239. cout << "Unesite[1,2,3,4]za dodavanje na racun\n";
  240. cout << "-------------------------------------\n";
  241. cout << " Unesite 0 za povratak na MENU\n";
  242. cout << "-------------------------------------\n";
  243. }
  244.  
  245. int get_amount()const { return amount; }
  246. string get_ime_pica(const int &i)const override { return ime[i]; }
  247. double get_cijena(const int &i)const override { return cijena[i]; }
  248.  
  249. BezalkoholniNapici&operator=(const BezalkoholniNapici &that);
  250. };
  251. BezalkoholniNapici&BezalkoholniNapici::operator=(const BezalkoholniNapici &that) {
  252. if (this == &that) {
  253. return *this;
  254. }
  255. amount = that.amount;
  256. ime = new string[amount];
  257. copy(that.ime, that.ime + that.amount, ime);
  258. cijena = that.cijena;
  259. return *this;
  260. }
  261.  
  262.  
  263. class Racun {
  264. public:
  265. Racun() :
  266. toplinapici{ nullptr }, alkoholonapica{ nullptr }, bezalkoholnapica{ nullptr }, slatkisi{ nullptr }, sadrzaj_racuna{ nullptr }, brojac{ 0 },izbor{ -1 }, ukupna_cijena{ 0 }{
  267. sadrzaj_racuna = new string[50];
  268. for (int i = 0; i < 50; i++) {
  269. sadrzaj_racuna[i] = "";
  270. }
  271. toplinapici = new TopliNapici;
  272. alkoholonapica = new AlkoholnaPica;
  273. bezalkoholnapica = new BezalkoholniNapici;
  274. slatkisi = new Slatkisi;
  275. }
  276. ~Racun() {
  277. delete toplinapici; toplinapici = nullptr;
  278. delete alkoholonapica; alkoholonapica = nullptr;
  279. delete bezalkoholnapica; bezalkoholnapica = nullptr;
  280. delete slatkisi; slatkisi = nullptr;
  281. delete[] sadrzaj_racuna; sadrzaj_racuna = nullptr;
  282. }
  283. string generisi_trenutno_vrijeme() {
  284. auto trenutno_vrijeme = chrono::system_clock::to_time_t(chrono::system_clock::now());
  285. return (string)ctime(&trenutno_vrijeme);
  286. }
  287.  
  288. void set_Racun_TopliNapici() {
  289. izbor = -1;
  290. toplinapici->print_drinks();
  291. try {
  292. while (izbor != 0) {
  293. cout << "Unesite pice na racun(1,2,3,4): "; cin >> izbor;
  294. if (izbor == 0)
  295. throw 0;
  296. cout << "Na racun dodan: " << toplinapici->get_ime_pica(get_izbor() - 1) << endl;
  297. ukupna_cijena += toplinapici->get_cijena(get_izbor() - 1);
  298. sadrzaj_racuna[brojac] = toplinapici->get_ime_pica(get_izbor() - 1) + " " + to_string(toplinapici->get_cijena(get_izbor() - 1)) + "KM";
  299. brojac++;
  300. }
  301. }
  302. catch (...) {
  303. cout << "----------------------------------\n";
  304. cout << "Za ispis racuna odaberite opciju 5" << endl;
  305. cout << "----------------------------------\n";
  306. }
  307. }
  308. void set_Racun_AlkoholniNapici() {
  309. izbor = -1;
  310. alkoholonapica->print_drinks();
  311. try {
  312. while (izbor != 0) {
  313. cout << "Unesite pice na racun(1,2,3,4): "; cin >> izbor;
  314. if (izbor == 0)
  315. throw 0;
  316. cout << "Na racun dodan: " << alkoholonapica->get_ime_pica(get_izbor() - 1) << endl;
  317. ukupna_cijena += alkoholonapica->get_cijena(get_izbor() - 1);
  318. sadrzaj_racuna[brojac] = alkoholonapica->get_ime_pica(get_izbor() - 1) + " " + to_string(alkoholonapica->get_cijena(get_izbor() - 1)) + "KM";
  319. brojac++;
  320. }
  321. }
  322. catch (...) {
  323. cout << "----------------------------------\n";
  324. cout << "Za ispis racuna odaberite opciju 5" << endl;
  325. cout << "----------------------------------\n";
  326. }
  327. }
  328. void set_Racun_BezalkoholniNapici() {
  329. izbor = -1;
  330. bezalkoholnapica->print_drinks();
  331. try {
  332. while (izbor != 0) {
  333. cout << "Unesite pice na racun(1,2,3,4): "; cin >> izbor;
  334. if (izbor == 0)
  335. throw 0;
  336. cout << "Na racun dodan: " << bezalkoholnapica->get_ime_pica(get_izbor() - 1) << endl;
  337. ukupna_cijena += bezalkoholnapica->get_cijena(get_izbor() - 1);
  338. sadrzaj_racuna[brojac] = bezalkoholnapica->get_ime_pica(get_izbor() - 1) + " " + to_string(bezalkoholnapica->get_cijena(get_izbor() - 1)) + "KM";
  339. brojac++;
  340. }
  341. }
  342. catch (...) {
  343. cout << "----------------------------------\n";
  344. cout << "Za ispis racuna odaberite opciju 5" << endl;
  345. cout << "----------------------------------\n";
  346. }
  347. }
  348.  
  349. void set_Racun_Slatkisi() {
  350. izbor = -1;
  351. slatkisi->print_SlatkiKutak();
  352. try {
  353. while (izbor != 0) {
  354. cout << "Unesite pice na racun(1,2,3,4): "; cin >> izbor;
  355. if (izbor == 0)
  356. throw 0;
  357. cout << "Na racun dodan: " <<slatkisi->get_imeSlatkisa(get_izbor() - 1) << endl;
  358. ukupna_cijena += slatkisi->get_cijenaSlatkisa(get_izbor() - 1);
  359. sadrzaj_racuna[brojac] = slatkisi->get_imeSlatkisa(get_izbor() - 1) + " " + to_string(slatkisi->get_cijenaSlatkisa(get_izbor() - 1)) + "KM";
  360. brojac++;
  361. }
  362. }
  363. catch (...) {
  364. cout << "----------------------------------\n";
  365. cout << "Za ispis racuna odaberite opciju 5" << endl;
  366. cout << "----------------------------------\n";
  367. }
  368. }
  369.  
  370. void ispisi_racun() {
  371. if (get_ukupnaCijena() == 0) {
  372. cout << "------------------------------------------\n";
  373. cout << "Niste otkucali niti jedan artikal na racun! " << endl;
  374. cout << "------------------------------------------\n";
  375. }
  376. else {
  377. ofstream unesi_u_datoteku("racuni.txt", ios::app);
  378. cout << "-----------------------------------------------------\n";
  379. unesi_u_datoteku<< "-----------------------------------------------------\n";
  380. cout << " Datum izdavanja racuna: " << generisi_trenutno_vrijeme();
  381. unesi_u_datoteku << " Datum izdavanja racuna: "<<generisi_trenutno_vrijeme() << endl;
  382. cout << "-----------------------------------------------------\n";
  383. unesi_u_datoteku<< "-----------------------------------------------------\n";
  384. for (int i = 0; i < brojac; i++) {
  385. unesi_u_datoteku << sadrzaj_racuna[i] << endl;
  386. cout << setw(35) << sadrzaj_racuna[i] << endl;
  387. unesi_u_datoteku<< " -----------------------------------------\n";
  388. cout << " -----------------------------------------\n";
  389. }
  390. unesi_u_datoteku<<setw(30)<< "Racun iznosi: " << get_ukupnaCijena() << " KM" << endl;
  391. cout << setw(30) << "Racun iznosi: " << get_ukupnaCijena() << " KM" << endl;
  392. unesi_u_datoteku << " -----------------------------------------\n";
  393. cout << " -----------------------------------------\n";
  394. }
  395. }
  396.  
  397. int get_izbor()const { return izbor; }
  398. double get_ukupnaCijena()const { return ukupna_cijena; }
  399.  
  400. Racun&operator=(const Racun &that);
  401. private:
  402. I_Drinks *toplinapici;
  403. I_Drinks *alkoholonapica;
  404. I_Drinks *bezalkoholnapica;
  405. I_SlatkiKutak *slatkisi;
  406. string *sadrzaj_racuna;
  407. int brojac;
  408. int izbor;
  409. mutable double ukupna_cijena;
  410. };
  411. Racun&Racun::operator=(const Racun &that) {
  412. if (this == &that) {
  413. return *this;
  414. }
  415. toplinapici = new TopliNapici;toplinapici = that.toplinapici;
  416. alkoholonapica = new AlkoholnaPica;alkoholonapica = that.alkoholonapica;
  417. bezalkoholnapica = new BezalkoholniNapici;bezalkoholnapica = that.bezalkoholnapica;
  418. slatkisi = new Slatkisi; slatkisi = that.slatkisi;
  419. brojac = that.brojac;
  420. sadrzaj_racuna = new string[brojac];
  421. copy(that.sadrzaj_racuna,that.sadrzaj_racuna+that.brojac,sadrzaj_racuna);
  422. izbor = that.izbor;
  423. ukupna_cijena = that.ukupna_cijena;
  424. return *this;
  425. }
  426. struct node {
  427. Racun racun;
  428. node *next;
  429. };
  430. int menu() {
  431. int izbor;
  432. do {
  433. cout << "----------------------------------------\n";
  434. cout << " MINI BAR MENU \n";
  435. cout << "----------------------------------------\n";
  436. cout << "1) Dodaj na racun (Topli napici) \n";
  437. cout << "2) Dodaj na racun (Alkoholni napici)\n";
  438. cout << "3) Dodaj na racun (Bezalhoholni napici)\n";
  439. cout << "4) Dodaj na racun (Slatki Kutak)\n";
  440. cout << "5) ISPISI RACUN\n";
  441. cout << "----------------------------------------\n";
  442. cout << "Unesite izbor: "; cin >> izbor;
  443. return izbor;
  444. system("pause"); system("cls");
  445. } while (1);
  446. }
  447.  
  448. class Kasa {
  449. public:
  450. Kasa():
  451. head{ nullptr }, tail{ nullptr }, neto{ 0 }, prosjek_po_racunu{ 0 } {
  452. string line;
  453. ifstream neto_check("neto.txt");
  454. int br = 0;
  455. while (getline(neto_check, line)) {
  456. br++;
  457. }
  458. neto_check.close();
  459. neto_check.open("neto.txt");
  460. if (br != 0) {
  461. while (getline(neto_check, line)) {
  462. neto = stoi(line);
  463. }
  464. }
  465. else {
  466. neto = 0;
  467. }
  468. neto_check.close();
  469.  
  470. br = 0;
  471. ifstream brojRacuna_check("broj_izdatih_racuna.txt");
  472. while (getline(brojRacuna_check, line)) {
  473. br++;
  474. }
  475. brojRacuna_check.close();
  476. brojRacuna_check.open("broj_izdatih_racuna.txt");
  477. if (br != 0) {
  478. while (getline(brojRacuna_check, line)) {
  479. broj_izdatih_racuna = stoi(line);
  480. }
  481. }
  482. else {
  483. broj_izdatih_racuna = 0;
  484. }
  485. br = 0;
  486. ifstream cijenaPoRacunu("prosjek_po_racunu.txt");
  487. while (getline(cijenaPoRacunu, line)) {
  488. br++;
  489. }
  490. cijenaPoRacunu.close();
  491. cijenaPoRacunu.open("prosjek_po_racunu.txt");
  492. if (br != 0) {
  493. while (getline(cijenaPoRacunu, line)) {
  494. prosjek_po_racunu = stoi(line);
  495. }
  496. }
  497. }
  498. ~Kasa() {
  499. node *t1 = head; node *t2 = nullptr;
  500. while (t1 != head) {
  501. t2 = t1->next;
  502. delete t1;
  503. t1 = t2;
  504. }
  505. }
  506. void set_Novi_Racun() {
  507. broj_izdatih_racuna++;
  508. ofstream broj_izdatih_racuna("broj_izdatih_racuna.txt");
  509. broj_izdatih_racuna << get_broj_izdatihRacuna();
  510. int izbor;
  511. node *temp = new node;
  512. temp->next = nullptr;
  513. if (head == nullptr) {
  514. head = temp;
  515. tail = temp;
  516. }
  517. else {
  518. tail->next = temp;
  519. tail = temp;
  520. }
  521. do {
  522. izbor = menu();
  523. if (izbor < 1 || izbor>5) {
  524. break;
  525. }
  526. if (izbor == 1) {
  527. temp->racun.set_Racun_TopliNapici();
  528. system("pause"); system("cls");
  529. }
  530. if (izbor == 2) {
  531. temp->racun.set_Racun_AlkoholniNapici();
  532. system("pause"); system("cls");
  533. }
  534. if (izbor == 3) {
  535. temp->racun.set_Racun_BezalkoholniNapici();
  536. system("pause"); system("cls");
  537. }
  538. if (izbor == 4) {
  539. temp->racun.set_Racun_Slatkisi();
  540. system("pause"); system("cls");
  541. }
  542. if (izbor == 5) {
  543. try {
  544. throw 0;
  545. }
  546. catch (...) {
  547. ofstream unesi_neto("neto.txt");
  548. temp->racun.ispisi_racun();
  549. neto +=temp->racun.get_ukupnaCijena();
  550. unesi_neto << get_Neto();
  551. ofstream prosjekpoRacunu("prosjek_po_racunu.txt");
  552. prosjek_po_racunu=get_Neto() / get_broj_izdatihRacuna();
  553. prosjekpoRacunu << get_prosjekPoRacunu();
  554. system("pause"); system("cls");
  555. }
  556. break;
  557. }
  558.  
  559. } while (1);
  560.  
  561. }
  562.  
  563. double get_Neto()const { return neto; }
  564. int get_broj_izdatihRacuna()const { return broj_izdatih_racuna; }
  565. double get_prosjekPoRacunu()const { return prosjek_po_racunu; }
  566.  
  567. Kasa &operator=(const Kasa &that);
  568. private:
  569. node *head, *tail;
  570. mutable double neto;
  571. static int broj_izdatih_racuna;
  572. mutable double prosjek_po_racunu;
  573. };
  574. int Kasa::broj_izdatih_racuna{ 0 };
  575. Kasa&Kasa::operator=(const Kasa &that) {
  576. if (this == &that) {
  577. return *this;
  578. }
  579. head = new node;head = that.head;
  580. tail = new node; tail = that.tail;
  581. neto = that.neto;
  582. broj_izdatih_racuna = that.broj_izdatih_racuna;
  583. prosjek_po_racunu = that.prosjek_po_racunu;
  584. return *this;
  585. }
  586. int Main_Menu() {
  587. int izbor;
  588. do {
  589. cout << "-----------------------------------\n";
  590. cout << " MAIN MENU \n";
  591. cout << "-----------------------------------\n";
  592. cout << "1) Otkucaj racun\n";
  593. cout << "2) Ispisi broj izdazih racuna\n";
  594. cout << "3) Ispisi ukpnu neto zaradu\n";
  595. cout << "4) Ipisi prosjecnu zaradu po racunu\n";
  596. cout << "5) KRAJ\n";
  597. cout << "-----------------------------------\n";
  598. cout << "Unesite izbor: "; cin >> izbor;
  599. return izbor;
  600. system("pause"); system("cls");
  601. } while (1);
  602. }
  603.  
  604. int main() {
  605.  
  606. int IZBOR;
  607. Kasa kasa;
  608. do {
  609. IZBOR = Main_Menu();
  610. if (IZBOR < 1 || IZBOR>4) {
  611. break;
  612. }
  613. if (IZBOR == 1) {
  614. system("pause"); system("cls");
  615. kasa.set_Novi_Racun();
  616. }
  617. if (IZBOR == 2) {
  618. cout << "-----------------------------\n";
  619. cout << "Broj izdatih racuna: " << kasa.get_broj_izdatihRacuna() << endl;
  620. cout << "-----------------------------\n";
  621. system("pause"); system("cls");
  622. }
  623. if (IZBOR == 3) {
  624. cout << "------------------------------------\n";
  625. cout << "Ukupna zarada iznosi: " << kasa.get_Neto() << " KM"<< endl;
  626. cout << "------------------------------------\n";
  627. system("pause"); system("cls");
  628. }
  629. if (IZBOR == 4) {
  630. cout << "--------------------------------------------------\n";
  631. cout << "Prosjecna zarada po jednom racunu iznosi: " << kasa.get_prosjekPoRacunu() << " KM"<<endl;
  632. cout << "--------------------------------------------------\n";
  633. system("pause"); system("cls");
  634. }
  635. } while (1);
  636.  
  637. system("pause");
  638. return 0;
  639. }
Add Comment
Please, Sign In to add comment