Advertisement
Guest User

Untitled

a guest
May 27th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.21 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Demo {
  3.  
  4. public static Idiotis[] arrayobj= new Idiotis[20];
  5. public static AsfaleiaZwhs[] arrayasf = new AsfaleiaZwhs[20];
  6. public static Plhrwmh[] plhrwmes = new Plhrwmh[20];
  7.  
  8. public static void main(String[] args) {
  9.  
  10. Scanner sc = new Scanner(System.in);
  11.  
  12. boolean flag = true;
  13.  
  14.  
  15. while (flag == true) {
  16. System.out.println("1.Ektupwsh olwn twn kataxwrhmenwn pelatwn"
  17. + "\n2.Ektupwsh olwn twn kataxwrhemwn asfaleiwn"
  18. + "\n3.Ektupwsh asafaleiwn Pelath"
  19. + "\n4.Eisagwgh neas asfaleias");
  20.  
  21. int sc1 = sc.nextInt();
  22.  
  23. if(sc1 == 0) {
  24. flag = false;
  25. }else if (sc1==1) {
  26. Idiotis.emfanish();
  27. }else if(sc1==2) {
  28. AsfaleiaZwhs.emfaniseis();
  29. }else if (sc1==3) {
  30. Demo d2 = new Demo();
  31. d2.check();
  32.  
  33. }else if(sc1==4){
  34. Demo d3 = new Demo();
  35. d3.create();
  36.  
  37.  
  38. }
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. }
  46. }
  47.  
  48. //methodos1
  49.  
  50.  
  51. //methodos2
  52.  
  53. public void check() {
  54. int m,t;
  55. boolean flag = false;
  56.  
  57. while (flag==false) {
  58.  
  59. Scanner sc = new Scanner(System.in);
  60. System.out.println("Parakalo eisagete ton kodiko tou pelath");
  61.  
  62. m = sc.nextInt();
  63.  
  64. for(int i =1; i<=Idiotis.k; i++){
  65.  
  66. t = Demo.arrayobj[i].getCode();
  67.  
  68. if(m == t) {
  69. flag = true;
  70. for(int j=1;j<=AsfaleiaZwhs.kk;j++)
  71. {
  72. if (arrayasf[j].getKpelaths()==m)
  73. {
  74. System.out.println(arrayasf[j].toString());
  75. System.out.println();
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }
  82.  
  83.  
  84. //method3
  85.  
  86. public void create() {
  87.  
  88. int m2;
  89. String m3;
  90. long m4;
  91. Scanner sc = new Scanner(System.in);
  92.  
  93. System.out.println("Parakalo doste 0 gia tin dimiourgia enos neou pelath h ton kodiko kapoiou pelath");
  94.  
  95. m2 = sc.nextInt();
  96.  
  97. if(m2==0) {
  98.  
  99.  
  100. Idiotis x = new Idiotis();
  101. // arrayobj[Idiotis.k-1] = new Idiotis();
  102.  
  103.  
  104. System.out.println("Parakalo doste onoma");
  105. m3 = sc.next();
  106. x.setFname(m3);
  107.  
  108. System.out.println("Parakalo doste epitheto");
  109. m3 = sc.next();
  110. x.setLname(m3);
  111.  
  112. System.out.println("Parakalo doste tilefono");
  113. m4 = sc.nextLong();
  114. x.setPhone(m4);
  115.  
  116. System.out.println("Parakalo doste email");
  117. m3 = sc.next();
  118. x.setEmail(m3);
  119.  
  120. System.out.println("Parakalo doste etos gennisis");
  121. m2 = sc.nextInt();
  122. x.setYear(m2);
  123.  
  124. System.out.println("Parakalo doste mina gennisis");
  125. m2 = sc.nextInt();
  126. x.setMonth(m2);
  127.  
  128. System.out.println("Parakalo doste imera gennisis");
  129. m2 = sc.nextInt();
  130. x.setDay(m2);
  131.  
  132. x.setCode(Idiotis.k);
  133. arrayobj[Idiotis.k] = x;
  134.  
  135.  
  136.  
  137. AsfaleiaZwhs x2= new AsfaleiaZwhs(Idiotis.k);
  138. Plhrwmh x3 = new Plhrwmh(AsfaleiaZwhs.kk,Idiotis.k);
  139.  
  140. System.out.println("Parakalo doste diarkeia tis asfaleias");
  141. m2 = sc.nextInt();
  142. x2.setDuration(m2);
  143.  
  144. System.out.println("Parakalo doste etos ekkinisis tis asfaleias");
  145. m2 = sc.nextInt();
  146. x2.setByear(m2);
  147. x3.setPyear(m2);
  148. x3.setPpyear(0);
  149.  
  150. System.out.println("Parakalo doste mina ekkinisis tis asfaleias");
  151. m2 = sc.nextInt();
  152. x2.setBmonth(m2);
  153. x3.setPmonth(m2+1);
  154. x3.setPpmonth(0);
  155.  
  156. System.out.println("Parakalo doste mera ekkinisis tis asfaleias");
  157. m2 = sc.nextInt();
  158. x2.setBday(m2);
  159. x3.setPday(m2);
  160. x3.setPpday(0);
  161.  
  162.  
  163. int p;
  164. p = AsfaleiaZwhs.ypologismos();
  165. x2.setAmount(p);
  166. x3.setPposo(p);
  167. x2.setUcode(AsfaleiaZwhs.kk);
  168. arrayasf[AsfaleiaZwhs.kk] = x2;
  169. x3.setKatastash("ekkremhs");
  170. x3.setPcode(Plhrwmh.kkk);
  171. plhrwmes[Plhrwmh.kkk]=x3;
  172. System.out.println("Epituxhs dhmiourgia asfaleias");
  173.  
  174. } else {
  175. boolean f = false;
  176. while (f == false) {
  177.  
  178. f = Idiotis.elegxos(m2);
  179.  
  180. if (f==true) {
  181. AsfaleiaZwhs x2= new AsfaleiaZwhs(m2);
  182. Plhrwmh x3 = new Plhrwmh(AsfaleiaZwhs.kk,m2);
  183.  
  184. System.out.println("Parakalo doste diarkeia tis asfaleias");
  185. m2 = sc.nextInt();
  186. x2.setDuration(m2);
  187.  
  188. System.out.println("Parakalo doste etos ekkinisis tis asfaleias");
  189. m2 = sc.nextInt();
  190. x2.setByear(m2);
  191. x3.setPyear(m2);
  192. x3.setPpyear(0);
  193.  
  194. System.out.println("Parakalo doste mina ekkinisis tis asfaleias");
  195. m2 = sc.nextInt();
  196. x2.setBmonth(m2);
  197. x3.setPmonth(m2+1);
  198. x3.setPpmonth(0);
  199.  
  200. System.out.println("Parakalo doste mera ekkinisis tis asfaleias");
  201. m2 = sc.nextInt();
  202. x2.setBday(m2);
  203. x3.setPday(m2);
  204. x3.setPpday(0);
  205.  
  206. x2.setUcode(AsfaleiaZwhs.kk);
  207. arrayasf[AsfaleiaZwhs.kk] = x2;
  208. x3.setKatastash("ekkremhs");
  209. x3.setPcode(Plhrwmh.kkk);
  210. plhrwmes[Plhrwmh.kkk]=x3;
  211. System.out.println("Egine me epituxia nea ekxwrhsh asfaleias");
  212. } else {
  213. System.out.println("ksanadwse kwdiko");
  214. m2 = sc.nextInt();
  215. }
  216. }
  217. }
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement