Advertisement
MixyPro

Untitled

Jan 9th, 2015
3,493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, ExtCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     RadioGroup1: TRadioGroup;
  12.     RadioGroup2: TRadioGroup;
  13.     RadioGroup3: TRadioGroup;
  14.     Button1: TButton;
  15.     ComboBox1: TComboBox;
  16.     CheckBox1: TCheckBox;
  17.     GroupBox1: TGroupBox;
  18.     Label3: TLabel;
  19.     Label1: TLabel;
  20.     Label2: TLabel;
  21.     Label4: TLabel;
  22.     Label5: TLabel;
  23.     Label6: TLabel;
  24.     Label7: TLabel;
  25.     Label8: TLabel;
  26.     Label9: TLabel;
  27.     Label10: TLabel;
  28.     Button2: TButton;
  29.     Label11: TLabel;
  30.     Label12: TLabel;
  31.     Button3: TButton;
  32.     Panel1: TPanel;
  33.     procedure RadioGroup2Click(Sender: TObject);
  34.     procedure RadioGroup3Click(Sender: TObject);
  35.     procedure Button1Click(Sender: TObject);
  36.     procedure CheckBox1Click(Sender: TObject);
  37.     procedure RadioGroup1Click(Sender: TObject);
  38.     procedure Button2Click(Sender: TObject);
  39.     procedure Button3Click(Sender: TObject);
  40.   private
  41.     { Private declarations }
  42.   public
  43.     { Public declarations }
  44.   end;
  45.  
  46. var
  47.   Form1: TForm1;
  48. ce, ce2, km:real;
  49. p,x,t,s:string;
  50. //Ovo su ti promenljive u zadatku
  51. implementation
  52.  
  53. {$R *.dfm}
  54.  
  55. procedure TForm1.RadioGroup2Click(Sender: TObject);
  56. begin
  57. //Radio grupa za ibarsku magistralu
  58. RadioGroup3.ItemIndex:=-1;
  59. Case RadioGroup2.ItemIndex of
  60. 0:Label1.Caption:='Zvecan';
  61. 1:Label1.Caption:='Socanica';
  62. 2:Label1.Caption:='Leposavic';
  63. 3:Label1.Caption:='Lesak';
  64. 4:Label1.Caption:='Raska';
  65. 5:Label1.Caption:='Usce';
  66. 6:Label1.Caption:='Kraljevo';
  67. 7:Label1.Caption:='Mrcajevci';
  68. 8:Label1.Caption:='Gornji Milanovac';
  69. 9:Label1.Caption:='Stepojevac';
  70. 10:Label1.Caption:='Beograd';
  71. end;
  72. end;
  73.  
  74. procedure TForm1.RadioGroup3Click(Sender: TObject);
  75. begin
  76. //Ovo ti je radiogroup za autoput..
  77. RadioGroup2.ItemIndex:=-1;
  78. Case RadioGroup3.ItemIndex of
  79. 0:Label1.Caption:='Zvecan';  
  80. 1:Label1.Caption:='Socanica';
  81. 2:Label1.Caption:='Leposavic';
  82. 3:Label1.Caption:='Lesak';
  83. 4:Label1.Caption:='Raska';
  84. 5:Label1.Caption:='Usce';
  85. 6:Label1.Caption:='Kraljevo';
  86. 7:Label1.Caption:='Kragujevac';
  87. 8:Label1.Caption:='Smederevo';
  88. 9:Label1.Caption:='Beograd';
  89. end;
  90. end;
  91.  
  92. procedure TForm1.Button1Click(Sender: TObject);
  93. var
  94. sediste:integer;
  95. sediste2:string;
  96. begin
  97. //Ovo ti je glavno dugme za program :D Sve resavas sa ovim.
  98. If RadioGroup1.ItemIndex=-1 then
  99. Label3.Caption:='Niste izabrali prevoznika!'
  100. else
  101. GroupBox1.Visible:=true;
  102. begin
  103. Label3.Caption:='';
  104. Case RadioGroup1.ItemIndex of
  105. //Ovo ti je za izabranog prevoznika
  106. 0:begin
  107. Label7.Caption:='Kolasin prevoz';
  108. Case RadioGroup2.ItemIndex of
  109. //Ovo ti je za izabrani put, trenutno za Ibarsku Magistralu
  110. 0:begin
  111. ce:=40;
  112. km:=3;
  113. end;
  114. 1:begin
  115. ce:=140;
  116. km:=26;
  117. end;
  118. 2:begin
  119. ce:=200;
  120. km:=36;
  121. end;
  122. 3:begin
  123. ce:=220;
  124. km:=45;
  125. end;
  126. 4:begin
  127. ce:=500;
  128. km:=62;
  129. end;
  130. 5:begin
  131. ce:=560;
  132. km:=75;
  133. end;
  134. 6:begin
  135. ce:=700;
  136. km:=150;
  137. end;
  138. 7:begin
  139. ce:=760;
  140. km:=160;
  141. end;
  142. 8:begin
  143. ce:=890;
  144. km:=210;
  145. end;
  146. 9:begin
  147. ce:=1100;
  148. km:=245;
  149. end;
  150. 10:begin
  151. ce:=1400;
  152. km:=349;
  153. end;
  154. end;
  155. Case RadioGroup3.ItemIndex of
  156. //Ovo su ti cene za autoput..
  157. 0:begin
  158. ce:=40;
  159. km:=3;
  160. end;
  161. 1:begin
  162. ce:=140;
  163. km:=26;
  164. end;
  165. 2:begin
  166. ce:=200;
  167. km:=36;
  168. end;
  169. 3:begin
  170. ce:=220;
  171. km:=45;
  172. end;
  173. 4:begin
  174. ce:=500;
  175. km:=62;
  176. end;
  177. 5:begin
  178. ce:=560;
  179. km:=75;
  180. end;
  181. 6:begin
  182. ce:=700;
  183. km:=150;
  184. end;
  185. 7:begin
  186. ce:=860;
  187. km:=175;
  188. end;
  189. 8:begin
  190. ce:=990;
  191. km:=260;
  192. end;
  193. 9:begin
  194. ce:=1440;
  195. km:=354;
  196. end;
  197. end;
  198. end;
  199. 1:begin
  200. Label7.Caption:='Kosmet prevoz';
  201. Case RadioGroup2.ItemIndex of
  202. //Ovo ti je za izabrani put, trenutno za Ibarsku Magistralu
  203. 0:begin
  204. ce:=45;
  205. km:=3;
  206. end;
  207. 1:begin
  208. ce:=130;
  209. km:=26;
  210. end;
  211. 2:begin
  212. ce:=210;
  213. km:=36;
  214. end;
  215. 3:begin
  216. ce:=230;
  217. km:=45;
  218. end;
  219. 4:begin
  220. ce:=510;
  221. km:=62;
  222. end;
  223. 5:begin
  224. ce:=550;
  225. km:=75;
  226. end;
  227. 6:begin
  228. ce:=690;
  229. km:=150;
  230. end;
  231. 7:begin
  232. ce:=740;
  233. km:=160;
  234. end;
  235. 8:begin
  236. ce:=870;
  237. km:=210;
  238. end;
  239. 9:begin
  240. ce:=1110;
  241. km:=245;
  242. end;
  243. 10:begin
  244. ce:=1420;
  245. km:=349;
  246. end;
  247. end;
  248. Case RadioGroup3.ItemIndex of
  249. //Ovo su ti cene za autoput..
  250. 0:begin
  251. ce:=50;
  252. km:=3;
  253. end;
  254. 1:begin
  255. ce:=130;
  256. km:=26;
  257. end;
  258. 2:begin
  259. ce:=180;
  260. km:=36;
  261. end;
  262. 3:begin
  263. ce:=200;
  264. km:=45;
  265. end;
  266. 4:begin
  267. ce:=480;
  268. km:=62;
  269. end;
  270. 5:begin
  271. ce:=540;
  272. km:=75;
  273. end;
  274. 6:begin
  275. ce:=680;
  276. km:=150;
  277. end;
  278. 7:begin
  279. ce:=870;
  280. km:=175;
  281. end;
  282. 8:begin
  283. ce:=970;
  284. km:=260;
  285. end;
  286. 9:begin
  287. ce:=1410;
  288. km:=354;
  289. end;
  290. end;
  291. end;
  292. 2:begin
  293. Label7.Caption:='Kavim Raska';
  294. Case RadioGroup2.ItemIndex of
  295. //Ovo ti je za izabrani put, trenutno za Ibarsku Magistralu
  296. 0:begin
  297. ce:=45;
  298. km:=3;
  299. end;
  300. 1:begin
  301. ce:=130;
  302. km:=26;
  303. end;
  304. 2:begin
  305. ce:=195;
  306. km:=36;
  307. end;
  308. 3:begin
  309. ce:=205;
  310. km:=45;
  311. end;
  312. 4:begin
  313. ce:=505;
  314. km:=62;
  315. end;
  316. 5:begin
  317. ce:=545;
  318. km:=75;
  319. end;
  320. 6:begin
  321. ce:=680;
  322. km:=150;
  323. end;
  324. 7:begin
  325. ce:=780;
  326. km:=160;
  327. end;
  328. 8:begin
  329. ce:=900;
  330. km:=210;
  331. end;
  332. 9:begin
  333. ce:=1120;
  334. km:=245;
  335. end;
  336. 10:begin
  337. ce:=1380;
  338. km:=349;
  339. end;
  340. end;
  341. Case RadioGroup3.ItemIndex of
  342. //Ovo su ti cene za autoput..
  343. 0:begin
  344. ce:=45;
  345. km:=3;
  346. end;
  347. 1:begin
  348. ce:=130;
  349. km:=26;
  350. end;
  351. 2:begin
  352. ce:=180;
  353. km:=36;
  354. end;
  355. 3:begin
  356. ce:=200;
  357. km:=45;
  358. end;
  359. 4:begin
  360. ce:=510;
  361. km:=62;
  362. end;
  363. 5:begin
  364. ce:=550;
  365. km:=75;
  366. end;
  367. 6:begin
  368. ce:=690;
  369. km:=150;
  370. end;
  371. 7:begin
  372. ce:=840;
  373. km:=175;
  374. end;
  375. 8:begin
  376. ce:=970;
  377. km:=260;
  378. end;
  379. 9:begin
  380. ce:=1450;
  381. km:=354;
  382. end;
  383. end;
  384. end;
  385. end;
  386. sediste:=random(50);
  387. sediste:=sediste+2;
  388. Str(sediste:2, sediste2);
  389. Label10.Caption:=sediste2;
  390. Str(km:3:0, p);
  391. Label12.Caption:=p;
  392. if ComboBox1.ItemIndex=-1 then
  393. ce2:=ce
  394. else
  395. begin
  396. Case ComboBox1.ItemIndex of
  397. 0:begin
  398. ce2:=ce;
  399. end;
  400. 1:begin
  401. ce2:=ce*0.70;
  402. end;
  403. 2:begin
  404. ce2:=ce*0.80;
  405. end;
  406. 3:begin
  407. ce2:=ce*0;
  408. end;
  409. end;
  410. end;
  411.  
  412. str(ce2:5:1, x);
  413. Label2.Caption:=x;
  414. end;
  415. end;
  416. procedure TForm1.CheckBox1Click(Sender: TObject);
  417. begin
  418. //Ovo ti oznacava autoput, da li se ide preko njega ili ne :D
  419. If CheckBox1.Checked=true then
  420. RadioGroup3.Visible:=true
  421. else
  422. RadioGroup3.Visible:=false;
  423. end;
  424.  
  425. procedure TForm1.RadioGroup1Click(Sender: TObject);
  426. begin
  427. //Ovo ti je kad se izabere prevoznik, da se u Labeli8 pojavi ime prevoznika
  428. Case RadioGroup1.ItemIndex of
  429. 0:Label8.Caption:='Kolasin prevoz';
  430. 1:Label8.Caption:='Kosmet prevoz';
  431. 2:Label8.Caption:='Kavim Raska';
  432. end;
  433. end;
  434.  
  435. procedure TForm1.Button2Click(Sender: TObject);
  436. begin
  437. //Ovo ti ponistava sve, vraca na pocetnu vrednost
  438. RadioGroup1.ItemIndex:=-1;
  439. ComboBox1.ItemIndex:=-1;
  440. CheckBox1.Checked:=false;
  441. RadioGroup2.ItemIndex:=-1;
  442. RadioGroup3.ItemIndex:=-1;
  443. GroupBox1.Visible:=false;
  444. Label8.Caption:='';
  445. end;
  446.  
  447. procedure TForm1.Button3Click(Sender: TObject);
  448. begin
  449. //Ovim zatvaras SVEEEEEEEEEEEEE :D
  450. close;
  451. end;
  452.  
  453. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement