Ask Question
13 April, 13:59

If you need a function to get both the number of items and the cost per item from a user, which would be a good function declaration to use?

+5
Answers (1)
  1. 13 April, 15:59
    0
    double costAndNumItems (int numOfItems, double costPerItem) {

    return 0;

    }

    Explanation:

    Above is how functions/methods are declared in Java programming language. We speficify the functions return type (double in this case), this is followed by the function's name costAndNumItems and then the arguments list which specifies the list of parameters that this function will accept. (numOfItems and costPerItem) followed by an open and close braces. Inside the braces is where the code for the functions behaviour is defined.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “If you need a function to get both the number of items and the cost per item from a user, which would be a good function declaration to use? ...” 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