Ask Question
7 May, 16:05

Write a function numberofpennies () that returns the total number of pennies given a number of dollars and (optionally) a number of pennies. ex: 5 dollars and 6 pennies returns 506.

+3
Answers (1)
  1. 7 May, 19:05
    0
    What language are you writing this in? C? jа vascript? Java? Are you allow to have parameters?

    The general idea should be the same. Since 1 dollar = 100 pennies, we should write something like ...

    Java:

    public static double numberofpennies (double dollars, double penny) {

    double sum = 0;

    / / The amount of pennies that dollar represents

    double converted = dollars * 100.0;

    sum = converted + penny;

    return sum;

    }

    Note: You should probably place this question under the category computer and technology instead of math. Also, this is just an example of what you could possibly write. What parameters you are allowed to use, what type (double? int? etc?) of pennies are you allowed to return, etc. depends on how you write it.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a function numberofpennies () that returns the total number of pennies given a number of dollars and (optionally) a number of ...” in 📙 Mathematics 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