Its a basic integer divison problem Integer division: How do you produce a double?
Either change int maxDays, days;
to double maxDays, days;
or change your calculate method from:
attendancePercentage=(days/maxDays)*100;
to:
attendancePercentage = ((double) days / (double) maxDays) * 100;`
solved Output of program unable to display correctly in Java [closed]