Ask Question

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.

+1
Answers (1)
  1. 20 March, 07:30
    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?
Find 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 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