i dont know how to get my test class to work and return a value entered.
my superclass must be abstract while my subclasses have to be concrete(non-abstract)
it seems that i cannot access the addition method from the testclass for some reason
package courseworkz;
public abstract class Coursework{
public void test()
{
if (answer<5000){
return;
}
}
public void view()
{
}
public class addition extends Coursework{
void add(double fnum, double snum)
{
double newanswer = fnum + snum;
newanswer = answer;
}
}
public class subtraction extends Coursework{
public void sub(double fnum, double snum)
{
double newanswer = fnum - snum;
newanswer = answer;
}
}
public class multiplication extends Coursework{
public void multiply(double fnum, double snum)
{
double newanswer = fnum * snum;
newanswer = answer;
}
}
public class division extends Coursework{
public void divide(double fnum, double snum)
{
double newanswer = fnum / snum;
newanswer = answer;
}
}
double fnum; double initial; double snum; double answer;
}
this is my test class
package courseworkz;
public class courseworktest
{
public static void main(String[]args){
addition test = new addition();
test.add(5);
}
}
thanx for the help