Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Demo {
- public static Idiotis[] arrayobj= new Idiotis[20];
- public static AsfaleiaZwhs[] arrayasf = new AsfaleiaZwhs[20];
- public static Plhrwmh[] plhrwmes = new Plhrwmh[20];
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- boolean flag = true;
- while (flag == true) {
- System.out.println("1.Ektupwsh olwn twn kataxwrhmenwn pelatwn"
- + "\n2.Ektupwsh olwn twn kataxwrhemwn asfaleiwn"
- + "\n3.Ektupwsh asafaleiwn Pelath"
- + "\n4.Eisagwgh neas asfaleias");
- int sc1 = sc.nextInt();
- if(sc1 == 0) {
- flag = false;
- }else if (sc1==1) {
- Idiotis.emfanish();
- }else if(sc1==2) {
- AsfaleiaZwhs.emfaniseis();
- }else if (sc1==3) {
- Demo d2 = new Demo();
- d2.check();
- }else if(sc1==4){
- Demo d3 = new Demo();
- d3.create();
- }
- }
- }
- //methodos1
- //methodos2
- public void check() {
- int m,t;
- boolean flag = false;
- while (flag==false) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Parakalo eisagete ton kodiko tou pelath");
- m = sc.nextInt();
- for(int i =1; i<=Idiotis.k; i++){
- t = Demo.arrayobj[i].getCode();
- if(m == t) {
- flag = true;
- for(int j=1;j<=AsfaleiaZwhs.kk;j++)
- {
- if (arrayasf[j].getKpelaths()==m)
- {
- System.out.println(arrayasf[j].toString());
- System.out.println();
- }
- }
- }
- }
- }
- }
- //method3
- public void create() {
- int m2;
- String m3;
- long m4;
- Scanner sc = new Scanner(System.in);
- System.out.println("Parakalo doste 0 gia tin dimiourgia enos neou pelath h ton kodiko kapoiou pelath");
- m2 = sc.nextInt();
- if(m2==0) {
- Idiotis x = new Idiotis();
- // arrayobj[Idiotis.k-1] = new Idiotis();
- System.out.println("Parakalo doste onoma");
- m3 = sc.next();
- x.setFname(m3);
- System.out.println("Parakalo doste epitheto");
- m3 = sc.next();
- x.setLname(m3);
- System.out.println("Parakalo doste tilefono");
- m4 = sc.nextLong();
- x.setPhone(m4);
- System.out.println("Parakalo doste email");
- m3 = sc.next();
- x.setEmail(m3);
- System.out.println("Parakalo doste etos gennisis");
- m2 = sc.nextInt();
- x.setYear(m2);
- System.out.println("Parakalo doste mina gennisis");
- m2 = sc.nextInt();
- x.setMonth(m2);
- System.out.println("Parakalo doste imera gennisis");
- m2 = sc.nextInt();
- x.setDay(m2);
- x.setCode(Idiotis.k);
- arrayobj[Idiotis.k] = x;
- AsfaleiaZwhs x2= new AsfaleiaZwhs(Idiotis.k);
- Plhrwmh x3 = new Plhrwmh(AsfaleiaZwhs.kk,Idiotis.k);
- System.out.println("Parakalo doste diarkeia tis asfaleias");
- m2 = sc.nextInt();
- x2.setDuration(m2);
- System.out.println("Parakalo doste etos ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setByear(m2);
- x3.setPyear(m2);
- x3.setPpyear(0);
- System.out.println("Parakalo doste mina ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setBmonth(m2);
- x3.setPmonth(m2+1);
- x3.setPpmonth(0);
- System.out.println("Parakalo doste mera ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setBday(m2);
- x3.setPday(m2);
- x3.setPpday(0);
- int p;
- p = AsfaleiaZwhs.ypologismos();
- x2.setAmount(p);
- x3.setPposo(p);
- x2.setUcode(AsfaleiaZwhs.kk);
- arrayasf[AsfaleiaZwhs.kk] = x2;
- x3.setKatastash("ekkremhs");
- x3.setPcode(Plhrwmh.kkk);
- plhrwmes[Plhrwmh.kkk]=x3;
- System.out.println("Epituxhs dhmiourgia asfaleias");
- } else {
- boolean f = false;
- while (f == false) {
- f = Idiotis.elegxos(m2);
- if (f==true) {
- AsfaleiaZwhs x2= new AsfaleiaZwhs(m2);
- Plhrwmh x3 = new Plhrwmh(AsfaleiaZwhs.kk,m2);
- System.out.println("Parakalo doste diarkeia tis asfaleias");
- m2 = sc.nextInt();
- x2.setDuration(m2);
- System.out.println("Parakalo doste etos ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setByear(m2);
- x3.setPyear(m2);
- x3.setPpyear(0);
- System.out.println("Parakalo doste mina ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setBmonth(m2);
- x3.setPmonth(m2+1);
- x3.setPpmonth(0);
- System.out.println("Parakalo doste mera ekkinisis tis asfaleias");
- m2 = sc.nextInt();
- x2.setBday(m2);
- x3.setPday(m2);
- x3.setPpday(0);
- x2.setUcode(AsfaleiaZwhs.kk);
- arrayasf[AsfaleiaZwhs.kk] = x2;
- x3.setKatastash("ekkremhs");
- x3.setPcode(Plhrwmh.kkk);
- plhrwmes[Plhrwmh.kkk]=x3;
- System.out.println("Egine me epituxia nea ekxwrhsh asfaleias");
- } else {
- System.out.println("ksanadwse kwdiko");
- m2 = sc.nextInt();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement