about | help | code help+videos | done | prefs |
Write a method that returns a string showing the amount of money you have in dollars and decimal fractions of dollars (also known as "cents"). For example, if 'dollars' is 12 and 'cents' is 3, you would return the string "$12.03". Note that the placement of the "3" matters. Returning "$12.3" is incorrect in this case as that would mean you had 30 cents, not 3 cents. As preconditions, you may assume that dollars>=0 and 0<=cents<=99 (Note: This is NOT valid Java code! It does have a mathematical meaning though.) Look at the test data for examples. Note: This does not require some fancy code that you haven't learned yet! It can be done just using what you already are supposed to know. quiz2023_09_26_APP1SLHL_dollarsAndCents(17, 23) → "$17.23" quiz2023_09_26_APP1SLHL_dollarsAndCents(41, 7) → "$41.07" quiz2023_09_26_APP1SLHL_dollarsAndCents(0, 0) → "$0.00" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 220
Copyright Nick Parlante 2017 - privacy