Hi, Im been working with a project now, and have got stuck. Cant see what im doing wrong. Im supposed to make a Digital Thermometer. Right now im stuck on passing values from one class to another, been trying to use get methods.It seems like the value I get is 0 all the time. Have placed alot of sout lines and have seen that the values should be different from 0.
//This is the method that will be executed when the buttom show max is pushed
public void showMax() {
tempMaxInne = comp.getMaxInne();
tempMaxUte = comp.getMaxUte();
System.out.println("This is max insdie: " + tempMaxInne);
System.out.println("This is max outside: " + tempMaxUte);
}
The comp.getMaxInne();
will call the method from the compare class That looks like:
public class compare {
private int minOutside;
private int maxOutside;
private int minInside;
private int maxInside;
private int currMax;
private int currMin;
private int Compare;
public compare(){
}
public void compareMin(int temp, boolean iutemp) {//iutemp will just tell if it is inside or outside
currMin = temp;
//System.out.println("Nå sammenlignes min");
if(iutemp == false){
// System.out.println("Nå sammenlignes min ute");
if(currMin<minOutside){
minOutside =currMin;
//setMinUte(currMax);
}
}
else{
if(currMin<minInside){
minInside =currMin;
//setMinInne(currMax);
}
}
}
public void compareMax(int temp, boolean iutemp) {
currMax = temp;
//debugging
System.out.println("Temp som motas" + currMax);
System.out.println("Current maxInne" + maxInside);
System.out.println("Current maxInne" + maxOutside);
System.out.println("Nå sammenlignes max");
if(iutemp == false){
if(currMax>maxOutside){
maxOutside =currMax;
//setMaxUte(currMax);
System.out.println("Maxute: " + maxOutside);
}
}
else{
if(currMax>maxInside){
maxInside =currMax;
//setMaxInne(currMax);
System.out.println("MaxInne: " + maxInside);
}
}
}
//Just some this i tested
/* public void setMaxInne(int max){
this.maxInside = max;
}
public void setMaxUte(int max){
this.maxOutside = max;
}
public void setMinUte(int min){
this.minOutside = min;
}
public void setMinInne(int min){
this.minInside = min;
}*/
public int getMaxInne() {
// System.out.println("Nå skal det Returneres: " + maxInside);
return maxInside;
}
public int getMinInne() {
return minInside;
}
public int getMaxUte() {
return maxOutside;
}
public int getMinUte() {
return minOutside;
}
/* public int getRandom() {
return Compare;
}
*/
}
Any pointers in the right direction would be great.