Changes

Jump to: navigation, search

Teams Winter 2011/team2/lab2

2,736 bytes added, 21:54, 17 February 2011
Created page with '=Tutorial= ==Prerequisites== * Download [http://www.eclipse.org/downloads/packages/eclipse-classic-361/heliossr1 Eclipse Classic] ==Creating and Setting the Interface Bundle== *R…'
=Tutorial=
==Prerequisites==
* Download [http://www.eclipse.org/downloads/packages/eclipse-classic-361/heliossr1 Eclipse Classic]
==Creating and Setting the Interface Bundle==
*Run Eclipse
*Select/Enter your preferred workspace in the text box provided and click okay
[[File:Workspace2T2.png]]
*After Eclipse has completed loaded, create a plug-in by clicking on "File" on the menu bar then scroll to New->Project->Plug-in
*Enter the following information that is seen in the image below
[[File:PluginT2.png]]
*Click Next
*[[File:Plugin2T2.png]]
*Click Finish
*Now open the src folder, right-click on the pre-created bundle, and create a class called "Weather" and an interface called "WeatherSystem"
*Copy and paste the following code to their respective file
'''Weather'''
<pre>
package ecl.team2.lab2.weather;

public class Weather {
private String city;
private float tempInCelcius;
private float rainInMM;
private float snowInMM;
private float windspeedInKM;
private char windDirection;

public Weather(String pcity, float ptemp, float prain, float psnow, float pwspeed, char pwdirection){
this.setCity(pcity);
this.setTempInCelcius(ptemp);
this.setRainInMM(prain);
this.setSnowInMM(psnow);
this.setWindspeedInKM(pwspeed);
this.setWindDirection(pwdirection);
}


public void setWindDirection(char windDirection) {
this.windDirection = windDirection;
}

public char getWindDirection() {
return windDirection;
}



public void setWindspeedInKM(float windspeedInKM) {
this.windspeedInKM = windspeedInKM;
}



public float getWindspeedInKM() {
return windspeedInKM;
}



public void setSnowInMM(float snowInMM) {
this.snowInMM = snowInMM;
}



public float getSnowInMM() {
return snowInMM;
}



public void setRainInMM(float rainInMM) {
this.rainInMM = rainInMM;
}



public float getRainInMM() {
return rainInMM;
}



public void setTempInCelcius(float tempInCelcius) {
this.tempInCelcius = tempInCelcius;
}



public float getTempInCelcius() {
return tempInCelcius;
}



public void setCity(String city) {
this.city = city;
}



public String getCity() {
return city;
}
}
</pre>
'''WeatherSystem'''
<pre>
package ecl.team2.lab2.weather;

public interface WeatherSystem {
Weather getWeather(String city) throws Exception;
}
</pre>
*Save and close both files and now open the manifest file
[[File:ManiT2.png]]
*Click on the runtime tab then click on add in the "export packages" panel.
*click on the ecl.... package and click okay
[[File:Mani2T2.png]
1
edit

Navigation menu