Ask Question
8 August, 11: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

+5
Answers (1)
  1. 8 August, 13:22
    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?
Find 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 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