Ask Question
4 December, 17:26

printLarger is a method that accepts two int arguments and returns no value. Two int variables, sales1 and sales2, have already been declared and initialized. Write a statement that calls printLarger, passing it sales1 and sales2. Assume that printLarger is defined in the same class that calls it.

+2
Answers (1)
  1. 4 December, 20:25
    0
    public static void printLarger (double sales1, double sales2) {

    if (sales1>sales2) {

    System. out. println (sales1+" is larger");

    }

    else {

    System. out. println (sales2+" is larger");

    }

    }

    A complete code calling the printLarger method is given below

    Explanation:

    public class Larger{

    public static void main (String[] args) {

    int sales1 = 100;

    int sales2 = 120;

    printLarger (sales1, sales2);

    }

    public static void printLarger (int sales1, int sales2) {

    if (sales1>sales2) {

    System. out. println (sales1+" is larger");

    }

    else {

    System. out. println (sales2+" is larger");

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “printLarger is a method that accepts two int arguments and returns no value. Two int variables, sales1 and sales2, have already been ...” 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