Ask Question
26 July, 13:55

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. 26 July, 14:06
    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 & 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