Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AsfaleiaZwhs {
- private static int ucode;
- public static int kk = 0;
- private int duration;
- private int byear;
- private int bmonth;
- private int bday;
- private int code;
- static int kpelaths;
- private int amount;
- public AsfaleiaZwhs(int akpelaths) {
- kpelaths = akpelaths;
- kk = kk+1;
- }
- //Setters
- public void setDuration(int aduration) {
- duration = aduration;
- }
- public void setByear(int abyear) {
- byear = abyear;
- }
- public void setBmonth(int abmonth) {
- bmonth = abmonth;
- }
- public void setBday(int abday) {
- bday = abday;
- }
- public void setAmount(int aamount) {
- amount = aamount;
- }
- public void setUcode(int aucode) {
- ucode = aucode;
- }
- public void setKpelaths(int akpelaths) {
- kpelaths = akpelaths;
- }
- //Getters
- public int getDuration() {
- return duration;
- }
- public int getByear() {
- return byear;
- }
- public int getBmonth() {
- return bmonth;
- }
- public int getBday() {
- return bday;
- }
- public int getAmount() {
- return amount;
- }
- public int getUcode() {
- return ucode;
- }
- public int getKpelaths() {
- return kpelaths;
- }
- //ToString//
- public String toString() {
- return "Diarkeia: " + duration +
- "\nHmerominia Enarkshs: " +byear+"/"+bmonth+"/"+bday+
- "\nPoso: " + amount +
- "\nKwdikos Asfaleias: " + ucode +
- "\nKwdikos Pelath: " + kpelaths;
- }
- public static int ypologismos() {
- return (2016-Demo.arrayobj[kpelaths].getYear())* 6 + 30;
- }
- public static void emfaniseis() {
- for(int i = 1; i <= (AsfaleiaZwhs.kk); i++) {
- System.out.println(Demo.arrayasf[i].toString());
- }
- }
- public static void emfanishasfaleias(int m) {
- for (int i=0; i<=(Demo.arrayasf.length); i++) {
- int l = Demo.arrayasf[i].getKpelaths();
- if (l == m) {
- System.out.println(Demo.arrayasf[i].toString());
- }
- }
- }
- public boolean elegxosasfaleias(int n) {
- int p = 0;
- for (int i=0; i<(Demo.arrayasf.length); i++) {
- int v = Demo.arrayasf[i].getKpelaths();
- if ( n == v) {
- p++;
- }
- }
- if (p > 0) {
- return true;
- } else {
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement