Ask Question
23 October, 21:08

Write an if statement that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000. Assume bonus and goodsSold have been declared and initialized.

+4
Answers (1)
  1. 23 October, 21:27
    0
    if (goodsSold>500000) {

    bonus = 10000;

    }

    Explanation:

    A complete Java program that prompts user to enter value for goodsSold is given below:

    import java. util. Scanner;

    public class num14 {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    System. out. println ("Enter goods Sold: ");

    int goodsSold = in. nextInt ();

    int bonus = 0;

    if (goodsSold>500000) {

    bonus=10000;

    }

    System. out. println ("You bonus for "+goodsSold+" is "+bonus);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write an if statement that assigns 10,000 to the variable bonus if the value of the variable goodsSold is greater than 500,000. Assume ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers