Ask Question
20 January, 10:14

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?

+2
Answers (1)
  1. 20 January, 12:50
    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?
Get 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 & 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