+ 1
Output of the bonus and additional bonus
It only shows the output of the bonus and for the additional bonus, it didn't. Pls help https://code.sololearn.com/c0IKkSSAK58T/?ref=app
5 ответов
+ 2
The logic for determining additional bonus does not have a condition for when totalSales==10000. It only checks <10000 and >10000. So, for example, if you change totalSales to either 9999 or 10001, then additional bonus will print.
+ 1
Brian yess thanks, and more... how can I find the sum of the baseSalary, bonus and additionalBonus?
+ 1
Evy I think that I would change the String variables bonus and additionalBonus from being declared as String to make them int type. Initialize them to 0 at the beginning of the program, then update their values as they are calculated in the if statements. At the end of the program add them all together to print the grand total.
Here is one example of how to adjust the code where bonus is calculated. Do something similar with additionalBonus:
Change from:
bonus = "Bonus=quot;+(20+baseSalary);
System.out.println(bonus);
To:
bonus = (int)(20+baseSalary);
System.out.println("Bonus=quot;+bonus);
+ 1
Brian I finally got the output and it's correct!!!
~thank you for your guidance 😁
+ 1
~Thank You For your guidance ☺