Ask 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 bonus and goodsSold have been declared and initialized.

+1
Answers (1)
  1. 19 May, 04:52
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers