hi all
it has been a very long time since I have written anything in here everythings has sicne change, i cant even find the java forum in here but anyway, my problem, i am practing on dis program, jus started it actually. I have two classes only, as I said it is just a practice program. i have followed the instructed as it can tell me to. i did the mutators, accessors and the toString in the account class, which is done, have no problem there. the problem is in the SavingsAccount class is where the error is.
I have used it before in my other practices program and them and have never gotten this error before. have seen this particular before but not with this part of the program. it is the super keywork where i am getting the error. the program is inheritance. where it will inherit from the parent class.
the error is: String, String, int double has private access in the account class. this is because I am using the super keyword. here is the codes . any help would be appreciate. thanks much
this is the account class
public class Account {
private int accNum;
private String firstName;
private String lastName;
private double balance;
private Account(String fn, String ln, int an, double b){
firstName = fn;
lastName = ln;
accNum = an;
balance = b;
}
public int accNum(){
return accNum;
}
public String getfirstName(){
return firstName;
}
public String lastName(){
return lastName;
}
public double getbalance(){
return balance;
}
public void setaccNum(int accNum){
this.accNum = accNum;
}
public void setfirstName(String firstName){
this.firstName = firstName;
}
public void setlastName(String lastName){
this.lastName = lastName;
}
public void setbalance(double balance){
this.balance = balance;
}
public void setacctbal(double balance){
this.balance = balance;
}
@Override
public String toString(){
String getdetails = "first name "+firstName+ " "+ " last name "+ lastName+
" "+" account number "+ accNum+ " "+"balance "+ balance;
return getdetails;
}
this is the SavingsAccount class
package newpackage;
/**
*
* @author luanataylor
*/
public class SavingsAccount extends Account {
private final double interestRate;
public SavingsAccount(String fn, String ln, int an, double b, double ir){
super(fn,ln,an,b); this is where the error is.(string, string, int double, has private access in account.
interestRate=ir;
}
public void payinterestRate(){
double newbalance = super.getbalance();
newbalance = newbalance + (newbalance * interestRate);
super.setacctbal(newbalance);
}