/    Sign up×
Community /Pin to ProfileBookmark

i have problem with overriding methods

please people in this program how can we explain step by step of culcalation part ,the tyeacher whos teaching me is a very hotempered man and he wouldnt explain me except the output .
this program i have to writ in final exam this month 28/12/2005 for Gods sake

class Student{
String name;
int id;
int fees=500;
public void changeFees(){
fees = fees + fees*5/100;
System.out.println(“The fees are “+fees);
}
}
class FirstYearStudent extends Student{
public void changeFees(){
fees = fees +fees*
5/100 +10;
System.out.println(“The fees are “+fees);
}
}

class SecondYearStudent extends Student{
public void changeFees(){
fees = fees +fees*5/100 +50;
System.out.println(“The fees are “+fees);
}
}
class ThirdYearStudent extends Student{
public void changeFees(){
fees =fees +fees*
5/100 +100;
System.out.println(“The fees are “+fees);
}
public static void main(String[] abc){
Student s=new SecondYearStudent();
s.changeFees();
Student s2=new FirstYearStudent();
s2.changeFees();
}
}

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 18.2005 — That's Java not JavaScript; ask in the Java forum
×

Success!

Help @powerup spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...