Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose salary and bonus are variables of type double. Write an if-else statemen

ID: 3630374 • Letter: S

Question

Suppose salary and bonus are variables of type double. Write an if-else statement that does two things if it is true: it outputs the String "life is good" and changes the value of bonus by adding 100 to bonus provided that either salary is greater than or equal to MIN-SALARY or bonus is greater than or equal to MIN-BONUS other wise, it does these two things: it outputs the String "life is not fair" and if bonus is greater than 100 it subtracts 100 from bonus else it sets bonus to 0. MIN-SALARY and MIN_BONUS are named constants.

Explanation / Answer

please rate -thanks

if(salary>=MIN_SALARY||bonus>=MIN_BONUS)
   {System.out.println("Life is good");
    bonus+=100;
    }
else
     {System.out.println("Life is not fair");
    if(bonus>100)
         bonus-=100;
    else
         bonus=0;
    }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote