Hey everybody,
I was wondering if somebody could help me. I'm having trouble with this assignment, tried to email my teacher a few days ago and he has not returned my email, it's for an online class. The whole chapter is talking about abstract classes and Inheritance and it's very confusing to me. In this assignment we have a parent class named Student which has the constant variables, instance variables, concrete and abstract methods. It has two child classes called FullTimeStudent and PartTimeStudent. When I try to run my code I get the error: FullTime Student is not abstract and does not override abstract method setCreditHrs() in Student. This is my code for my parent class:
public abstract class Student
{
final double MIN_FULLTIME_HRS = 12.0;
final double MAX_FULLTIME_HRS = 20.0;
final double MIN_PARTTIME_HRS = 0.5;
final double MAX_PARTTIME_HRS = 11.5;
final double TUITION_RATE = 240.5;
String name;
double creditHrs;
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public abstract double getFinAid();
public abstract double getCreditHrs();
public abstract double setCreditHrs();
public abstract String getStatus();
}
and those methods at the end HAVE to be abstract according to the book. Here is my code for child class FullTimeStudent:
public class FullTimeStudent extends Student
{
final double FINAID_RATE = .8;
String status;
double finAid;
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public double getCreditHrs()
{
return creditHrs;
}
public void setCreditHrs(double creditHrs)
{
this.creditHrs = creditHrs;
}
public double getFinAid()
{
finAid = (TUITION_RATE * creditHrs) * FINAID_RATE;
return finAid;
}
}
now if somebody could help me understand where my error is coming from and maybe understand abstract methods a little bit I'd really appreciate it thanks.