I can't figure out why i'm getting these errors. Everything seems to be right. Any help would be much appreciated.
UnitTest.java:14: error: cannot find symbol
System.out.println("Cost to renew:" + j2.getStuPrice());
^
symbol: method getStuPrice()
location: variable j2 of type Subscriber
UnitTest.java:19: error: cannot find symbol
System.out.println("Cost to renew:" + j3.getPrePrice());
^
symbol: method getPrePrice()
location: variable j3 of type Subscriber
The code:
public class Subscriber{
protected int subID;
protected String name;
protected String Address;
public Subscriber(int argSubID,
String argName,
String argAddress){
subID=argSubID;
name=argName;
address=argAddress
}
public void setID(int arg){
subID=arg;
}
public void setName(String arg){
name=arg;
}
public void setAddress(String arg){
address=arg;
}
public int getID(){
return subID;
}
public String getName(){
return name;
}
public String getAddress(){
return address;
}
public double getRegPrice(){
return 20;
}
}
public class StudentSub
extends Subscriber{
public StudentSub(int argSubID, String argName, String argAddress){
super(argSubID, argName, argAddress);
}
public double getStuPrice(){
return 15;
}
}
public class PreSub
extends Subscriber{
public PreSub(int argSubID, String argName, String argAddress){
super(argSubID, argName, argAddress);
}
public double getPrePrice(){
return 50;
}
}
Test cases i'm using
public class UnitTest{
public static void main(String[] args){
Subscriber j1=new Subscriber(1234,"Isbelle Tzu", "45 Horizon");
System.out.println("Name: " + j1.getName());
System.out.println("Cost to renew:" + j1.getRegPrice());
System.out.println("------------------------------------------------------------");
Subscriber j2=new Subscriber(2334,"Timmy Nook", "56 Leaf");
System.out.println("Name: " + j2.getName());
System.out.println("Cost to renew:" + j2.getStuPrice());
System.out.println("------------------------------------------------------------");
Subscriber j3=new Subscriber(5465,"Tom Nook", "343 Horizon");
System.out.println("Name: " + j3.getName());
System.out.println("Cost to renew:" + j3.getPrePrice());
System.out.println("------------------------------------------------------------");
}
}
What I have tried:
Looking over my code to make sure i wasn't missing anything