Ask Question
2 August, 23:10

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.

+2
Answers (1)
  1. 2 August, 23:31
    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?
Find 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 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