+ 1

how i will add bonus with salary in this program :-

class Employee{ float salary=40000; } class Programmer extends Employee{ int bonus=10000; public static void main(String args[]){ Programmer p=new Programmer(); System.out.println("Programmer salary is:"+p.salary); System.out.println("Bonus of Programmer is:"+p.bonus); } }

16th Oct 2017, 6:01 AM
Prashant Kumar
Prashant Kumar - avatar
2 Answers
+ 1
are you looking for something like this ? I dont realy understand the question ^^ System.out.println("Salary with bonus:"+(p.bonus+p.salary));
16th Oct 2017, 7:10 AM
Chrizzhigh
Chrizzhigh - avatar
+ 2
@ Chrizzhigh Yes , Thank You!
16th Oct 2017, 7:15 AM
Prashant Kumar
Prashant Kumar - avatar