Ask 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?

+1
Answers (1)
  1. 28 November, 11:47
    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 & 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