All pastes #987660 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-16 18:25 UTC
rendered paste body
/**
 * @(#)Truck.java
 *
 *
 * @author 
 * @version 1.00 2008/4/10
 */


public class Truck extends Vehicle  {
	
	private double fortio;
	private int elkystikh;
	/** constructor gia na arxikopoihseis ta pedia
	 *tis truck alla me thn bpoh8eia tis super kai tis vehicle*/
	public  Truck(String kataskeuasths,int kulindroi,String name,double fortio, 
		int elkystikh)
		 {
		 	super( kataskeuasths, kulindroi, name );
		 	this.fortio=fortio;
		 	this.elkystikh=elkystikh;
		 }
	/** constructor xwris na pernei orismata gia na arxikopoihseis ta pedia
	 *tis truck alla me thn bpoh8eia tis super kai tis vehicle*/
	public Truck()
	{
		super();
		fortio=0;
		elkystikh=0;
	}
	/** me8odos pou epistrefei ton kataskeuasth*/
	public  String getkataskeuasths()
	{
		return(agetKataskeuasths());
	}
	/** me8odos pou epistrefei tous kulidrous*/
	public int getkulidroi()
	{
		return (agetkulidroi());
	}
    /** me8odos pou epistrefei ton person(idiokthth)*/
    public String getPerson()
    {
    	return(agetPerson());
    }
    
    /** me8odos pou epistrefei to fortio*/
    public double getFortio()
    {
    	return fortio;
    }
    /** me8odos pou epistrefei thn elkystikh ikanothta tou oxhmatos*/
    public int getElkystikh()
    {
    	return elkystikh;
    }
    /** me8odos pou pernaei timh ston kataskeuasth*/
    public void setkataskeuasths(String kataskeuasths)
    {
    	this.asetkataskeuasths(kataskeuasths);
    }
    /** me8odos pou pernaei timh stous kulindrous*/
    public void setkulidroi(int kulindroi)
    {
    	this.asetkulidroi(kulindroi);
    }
    /** me8odos pou pernaei timh sto  person*/
    public void asetPerson(String name)
    {
    	this.asetPerson(name);
    }
    /** me8odos pou pernaei timh sto fortio*/
    public void setFortio(double fortio)
    {
    	this.fortio=fortio;
    }
    /** me8odos pou pernaei timh ston kataskeuasth*/
    public void setElkystikh(int elkystikh)
    {
    	this.elkystikh=elkystikh;
    }
 
    public String toString()
    {
    	String a="";
    	a+="o kataskeyasths einai: " + this.agetKataskeuasths();
    	a+="\nto oxhma exei : "+ this.agetkulidroi()+" kulindrous"+"\n";
    	a+="o idiokths tou oxhmatos einai:" + this.getPerson()+"\n";
    	a+="to oxhma mporei na metafer baros:" + fortio+"\n";
    	a+="to oxhma sas exei elkystikh ikanothta " + elkystikh+" tonwn\n";
    	return a;
    }
    
    public boolean equals(Object other)
    {
    	if(other==null)
    	{
    		return false;
    	}
    	
    	if(other.getClass()!=this.getClass())
    	{
    		return false;
    	}
    	
    	if(this.equals(other)!=true||this.fortio!=this.fortio||this.elkystikh!=elkystikh)
    			{
    				return false;
    			}
    		else
    		{
    			return true;
    		}
    	
    }
    /** constructor pou kanei ba8u antigrafw tou antikeimenou*/
    public Truck clone()
    {
    	Truck klonos=new Truck(this.agetKataskeuasths(),this.agetkulidroi(),this.getPerson(), fortio,
		elkystikh);
		return klonos;
    }
     
}