Ask Question
21 June, 23:46

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. 22 June, 01:10
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers