Hi All
package apple;
import java.io.IOException;
import java.util.Scanner;
/**
*
* @author Mates
*/
public class Apple {
private double sample(){
double total;
int a=120;
Scanner as=new Scanner(System.in);
System.out.println("enter the value");
double i=as.nextDouble();
total=i*a;
System.out.println("apple"+i+"kg"+" "+total);
return total;
}
public double sample1(){
int b=50;
double total1;
System.out.println("enter the value of ");
Scanner bs=new Scanner(System.in);
double j=bs.nextDouble();
total1=j*b;
System.out.println(+total1);
return total1;
}
public void display(double total,double total1){
double tot;
tot=total+total1;
System.out.println("total is"+tot);
}
public static void main(String[] args) throws IOException {
Apple sam=new Apple();
sam.sample();
sam.sample1();
[B]sam.display(total, total1);[/B]
}
}
Here i am using sample and sample1 these two methods returns total and total1.While i run this piece of code throws an error.How can i get these two return values(total and total1) in to the main method and it is call to the display method to get a resultant output.Please let me know what kind of error it is...:-/
Thanks:)