+ 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

26th Mar 2022, 5:38 AM
Eyy
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.
26th Mar 2022, 7:40 AM
Brian
Brian - avatar
+ 1
Brian yess thanks, and more... how can I find the sum of the baseSalary, bonus and additionalBonus?
26th Mar 2022, 7:50 AM
Eyy
+ 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);
26th Mar 2022, 8:42 AM
Brian
Brian - avatar
+ 1
Brian I finally got the output and it's correct!!! ~thank you for your guidance 😁
26th Mar 2022, 9:12 AM
Eyy
+ 1
~Thank You For your guidance ☺
26th Mar 2022, 1:33 PM
Cute Girl
Cute Girl - avatar