Hello ,
i am new to java. I have to do a salary management software. So i created three classes Ergazomenos (in greek Employee) Proistamenos(in greek Boss) and Dieuthintis . I want to substract(-) an Ergazomenos form Proistamenos if only Ergazomenos belongs to Proistamenos.



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package ergasiatheotokis;

/**
*
* @author Owner
*/
public class Ergazomenos {

private String onoma;
private String epitheto;
private float vasikosMisthos;
private float Iperoria;
private Date imerominiaProslipsis;
private final Date imerominiaGennisis;
private final int afm;
private Date imerominiaApolisis;
private float antimisthia;

public Ergazomenos(String onoma, String epitheto, float vasikosMisthos, float Iperoria, Date imerominiaProslipsis, Date imerominiaGennisis, int afm, Date imerominiaApolisis, float antimisthia) {
this.onoma = onoma;
this.epitheto = epitheto;
this.vasikosMisthos = vasikosMisthos;
this.Iperoria = Iperoria;
this.imerominiaProslipsis = imerominiaProslipsis;
this.imerominiaGennisis = imerominiaGennisis;
this.afm = afm;
this.imerominiaApolisis = imerominiaApolisis;
this.antimisthia = antimisthia;
}

public float getAntimisthia() {
return antimisthia;
}

public void setAntimisthia(float antimisthia) {
this.antimisthia = antimisthia;
}












public float getIperoria() {
return Iperoria;
}

public void setIperoria(float Iperoria) throws NegativeSalaryException {
if(Iperoria<0) {
throw new NegativeSalaryException(Iperoria);
}
this.Iperoria = Iperoria;
}

public int getAfm() {
return afm;
}


public String getEpitheto() {
return epitheto;
}

public void setEpitheto(String epitheto) {
this.epitheto = epitheto;
}

public Date getImerominiaApolisis() {
return imerominiaApolisis;
}

public void setImerominiaApolisis(Date imerominiaApolisis) {
this.imerominiaApolisis = imerominiaApolisis;
}

public Date getImerominiaGennisis() {
return imerominiaGennisis;
}


public Date getImerominiaProslipsis() {
return imerominiaProslipsis;
}

public void setImerominiaProslipsis(Date imerominiaProslipsis) {
this.imerominiaProslipsis = imerominiaProslipsis;
}

public String getOnoma() {
return onoma;
}

public void setOnoma(String onoma) {
this.onoma = onoma;
}

public float getVasikosMisthos() {
return vasikosMisthos;
}

public void setVasikosMisthos(float vasikosMisthos) throws NegativeSalaryException {
if(vasikosMisthos<0){
throw new NegativeSalaryException(vasikosMisthos);
}

this.vasikosMisthos = vasikosMisthos;
}


@Override
public String toString() {
return "First name is: " + this.onoma +
" Last name is: " + this.epitheto +
"Iperoria is " +this.Iperoria +
"Imerominia proslipsis is" +this.imerominiaProslipsis.printDate()+
"Imeromonia gensis is " +this.imerominiaGennisis.printDate() +
"Afm is"+this.afm +
"Imerominia apolisis is" +this.imerominiaApolisis.printDate()+
"Vassikos misthos is" +this.vasikosMisthos +
"Minaies apodoxes ergazoemon einai " +this.minaiesApodoxes()+
"Taxes ergazomenou einai"+this.taxErgazomenos();



// private String onoma;
// private float vasikosMisthos = 0.0f;
// private float Iperoria;
// private Date imerominiaProslipsis;
// private final Date imerominiaGennisis;
/// private int afm;
// private Date imerominiaApolisis;

}

public float minaiesApodoxes()
{

return getVasikosMisthos()+(getIperoria()*getAntimisthia( ));
}

public double taxErgazomenos()
{
double foros=0;
if(getVasikosMisthos()<=12000) {
foros=0.01*getVasikosMisthos();
}
else if(getVasikosMisthos()>12000 && getVasikosMisthos()<16000)
{
foros = 15 / 100 * getVasikosMisthos();
}
else if(getVasikosMisthos()>16000 && getVasikosMisthos()<=18500)
{
foros=20/100*getVasikosMisthos();

}
else if(getVasikosMisthos()<18500 &&getVasikosMisthos()<=24000)
{
foros=28/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<24000 &&getVasikosMisthos()<=28000)
{
foros=35/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<28000 &&getVasikosMisthos()<=36000)
{
foros=40/100*getVasikosMisthos();
}
return foros;
}









}






/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package ergasiatheotokis;

/**
*
* @author Owner
*/
public class Proistamenos extends Ergazomenos {



private String onomaTmimatos;
private Date ImerominaProistamenos;
private Date ImerominiaPausisProistamenos;
private int numberOfErgazomenous;
private int epidomaThesis;

public Proistamenos(String onoma, String epitheto, float
vasikosMisthos, float Iperoria, Date imerominiaProslipsis,
Date imerominiaGennisis, int afm, Date imerominiaApolisis, float antimisthia,
String onomaTmimatos, Date ImerominaProistamenos, Date
ImerominiaPausisProistamenos, int numberOfErgazomenous, int epidomaThesis) {
super(onoma, epitheto, vasikosMisthos, Iperoria, imerominiaProslipsis,
imerominiaGennisis,afm,imerominiaApolisis,antimist hia);
}





public Date getImerominaProistamenos() {
return ImerominaProistamenos;
}

public void setImerominaProistamenos(Date ImerominaProistamenos) {
this.ImerominaProistamenos = ImerominaProistamenos;
}

public Date getImerominiaPausisProistamenos() {
return ImerominiaPausisProistamenos;
}

public void setImerominiaPausisProistamenos(Date ImerominiaPausisProistamenos) {
this.ImerominiaPausisProistamenos = ImerominiaPausisProistamenos;
}

public int getEpidomaThesis() {
return epidomaThesis;
}

public void setEpidomaThesis(int epidomaThesis) {
this.epidomaThesis = epidomaThesis;
}

public int getNumberOfErgazomenous() {
return numberOfErgazomenous;
}

public void setNumberOfErgazomenous(int numberOfErgazomenous) {
this.numberOfErgazomenous = numberOfErgazomenous;
}

public String getOnomaTmimatos() {
return onomaTmimatos;
}

public void setOnomaTmimatos(String onomaTmimatos) {
this.onomaTmimatos = onomaTmimatos;
}


public float EmployeeApodoxes()

{
return getVasikosMisthos()+getEpidomaThesis();
}

@Override
public double taxErgazomenos()
{
double foros=0;
if(getVasikosMisthos()<=12000) {
foros=0.01*getVasikosMisthos();
}
else if(getVasikosMisthos()>12000 && getVasikosMisthos()<16000)
{
foros = 15 / 100 * getVasikosMisthos();
}
else if(getVasikosMisthos()>16000 && getVasikosMisthos()<=18500)
{
foros=20/100*getVasikosMisthos();

}
else if(getVasikosMisthos()<18500 &&getVasikosMisthos()<=24000)
{
foros=28/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<24000 &&getVasikosMisthos()<=28000)
{
foros=35/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<28000 &&getVasikosMisthos()<=36000)
{
foros=40/100*getVasikosMisthos();
}
return foros;


}
}




/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package ergasiatheotokis;

/**
*
* @author Owner
*/
public class Dieuthintis extends Ergazomenos
{

public Dieuthintis(String onoma, String epitheto, float vasikosMisthos, float Iperoria, Date imerominiaProslipsis, Date imerominiaGennisis, int afm, Date imerominiaApolisis, float antimisthia, String OnomaDieuthinsis, Date imerominiaAnalipsisKathikonton, Date imeroniaApalagisApoKathikonta, int ImerominiaThesisEuthinis, int bonus) {
super(onoma, epitheto, vasikosMisthos, Iperoria, imerominiaProslipsis,
imerominiaGennisis,afm,imerominiaApolisis,antimist hia);








}


private String OnomaDieuthinsis;
private Date imerominiaAnalipsisKathikonton;
private Date imeroniaApalagisApoKathikonta;
private int EpidomaThesisEuthinis;
private int bonus;

public int getEpidomaThesisEuthinis() {
return EpidomaThesisEuthinis;
}

public void setEpidomaThesisEuthinis(int EpidomaThesisEuthinis) {
this.EpidomaThesisEuthinis = EpidomaThesisEuthinis;
}





public String getOnomaDieuthinsis() {
return OnomaDieuthinsis;
}

public void setOnomaDieuthinsis(String OnomaDieuthinsis) {
this.OnomaDieuthinsis = OnomaDieuthinsis;
}

public int getBonus() {
return bonus;
}

public void setBonus(int bonus) {
this.bonus = bonus;
}

public Date getImerominiaAnalipsisKathikonton() {
return imerominiaAnalipsisKathikonton;
}

public void setImerominiaAnalipsisKathikonton(Date imerominiaAnalipsisKathikonton) {
this.imerominiaAnalipsisKathikonton = imerominiaAnalipsisKathikonton;
}

public Date getImeroniaApalagisApoKathikonta() {
return imeroniaApalagisApoKathikonta;
}

public void setImeroniaApalagisApoKathikonta(Date imeroniaApalagisApoKathikonta) {
this.imeroniaApalagisApoKathikonta = imeroniaApalagisApoKathikonta;
}

@Override
public String toString() {
return "First name is: " + this.OnomaDieuthinsis +
" imerominia Analipsis Kathikonton is: " + this.imerominiaAnalipsisKathikonton +
"Epidoma thesis euthinis is " +this.EpidomaThesisEuthinis +
"Bonus is" +this.bonus+
"Imeromonia apalagis kathikonton is " +this.imeroniaApalagisApoKathikonta ;
}
public float minaiesApodoxesDieuthinti()
{

return getVasikosMisthos()+ getEpidomaThesisEuthinis()+getBonus();
}
@Override

public double taxErgazomenos()
{
double foros=0;
if(getVasikosMisthos()<=12000) {
foros=0.01*getVasikosMisthos();
}
else if(getVasikosMisthos()>12000 && getVasikosMisthos()<16000)
{
foros = 15 / 100 * getVasikosMisthos();
}
else if(getVasikosMisthos()>16000 && getVasikosMisthos()<=18500)
{
foros=20/100*getVasikosMisthos();

}
else if(getVasikosMisthos()<18500 &&getVasikosMisthos()<=24000)
{
foros=28/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<24000 &&getVasikosMisthos()<=28000)
{
foros=35/100*getVasikosMisthos();
}

else if(getVasikosMisthos()<28000 &&getVasikosMisthos()<=36000)
{
foros=40/100*getVasikosMisthos();
}
return foros;


}












}




/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package ergasiatheotokis;

import java.util.ArrayList;
/**
*
* @author Owner
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here






Ergazomenos e=new Ergazomenos("n","v",2000f, 200f, new Date(12,3, 1989),new Date(12,3, 1989), 40,new Date(12,3, 1989),14);
System.out.println("e"+e.toString() );


try {
e.setVasikosMisthos(-10000);
}
catch(NegativeSalaryException nse)
{
System.out.println(nse.toString());




}

try {
e.setIperoria(1000);
}

catch(NegativeSalaryException nse)
{
System.out.println(nse.toString());




}

}
//Ergazomenos e2=new Ergazomenos("n","v",2000f, 200f, new Date(12,3, 1989),new Date(12,3, 1989), 40,new Date(12,3, 1989),14);

// ArrayList<Ergazomenos> listaErgazomenom = new ArrayList<Ergazomenos>();
Proistamenos e=new Proistamenos("nikos","vassilakks",2000f, 200f, new Date(12,3, 1989),new Date(12,3, 1989), 40,new Date(12,3, 1989),
14,"onoma",new Date(12,3,1984),new Date(12,3,1984),11,10);

if(e instanceof Ergazomenos)
{
Ergazomenos p=(Ergazomenos)e;
}


// public Proistamenos(String onoma, String epitheto, float
// vasikosMisthos, float Iperoria, Date imerominiaProslipsis,
// Date imerominiaGennisis, int afm, Date imerominiaApolisis, float antimisthia,
// String onomaTmimatos, Date ImerominaProistamenos, Date
// ImerominiaPausisProistamenos, int numberOfErgazomenous, int epidomaThesis)
}



// e.setSalary(-25000);
// }
// catch(NegativeSalaryException nse) {
// System.out.println(nse.toString());
//nse.printStackTrace();
// try{
// e.setSalary(Math.abs(nse.getAmount()));
/// System.out.println(e.getSalary());
// }
// catch(NegativeSalaryException nse1){
// }
//System.out.println(e.getSalary());






























I have an idea to use ArrayList for Ergazomenos but i am not sure . Thanks in advance