Ask Question
4 May, 04:14

If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an appropriate function declaration

+4
Answers (1)
  1. 4 May, 08:02
    0
    public static double costOfCandy (int numOfCandy) {

    }

    Explanation:

    In Java programming language the appropriate method declaration is given above.

    In this declaration, the method has been named costOfCandy, it will accept one parameter of type int numOfCandy and will return a double value representing the cost of candy.

    The complete method definition is given below:

    public static double costOfCandy (int numOfCandy) {

    double cost = numOfCandy*25;

    return cost;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an appropriate ...” 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