casting of values
i have a problem. i want to return a double value by the division of two integers. the values i am getting is not as expected. for example if the lectureduration =3,and no_of_session =2, i expect to get 1.5 but i am getting 1.0.
here are some of the codes.
double calculate()
{
double i;
System.out.println(lectureduration+"\t"+no_of_session);
i=(float)(lectureduration/no_of_session);
return i;
}
public static void main(String args[])
{
prof p= new prof();
p.setsession(2);
p.setlectureduration(3);
double a=p.calculate();
System.out.println(a);
p.setsession(1);
p.setlectureduration(3);
a=p.calculate();
System.out.println(a);
}
can anyone help?
thank you.

