So I have a class called student and one of the variables is tuition rate, i want to set the tuition in the other class but i dont want to make the variable public, is there a way to do it?
Heres my first part of code from the abstract class Student
public abstract void setTuition(double rateIn);
public abstract double getTuition();
abstract String Display()
now heres where im trying to override the tuition in the Undergraduate class
@Override
public void setTuition(double rateIn){
rateIn=200*super.getHours();
}
@Override
public String Display(){
return("name "+super.getLastName()+", "+super.getFirstName()+"\n"+
"ID "+super.getStudentId()+"\n"+
"Enrollment "+super.getHours()+"\n"+
"tuition $"+());
//Here i need the variable so i can print it out
}
(I know there isnt a get method but i have added one i just forgot to put it in)
All i need is a way to print out the variable