FastPrepFastPrep
Problem Brief

Calculate Change

OA

Given 2 non-negative double numbers first representing price of product (pp) bought by customer and second representing cash given by customer. Cashier has (100,50,20,10,5,2,1,0.5,0.25,0.1,0.05,0.01) as bills. Return bills returned to customer as a comma separated string. String has to be alphabetically sorted.

1Example 1

Input
pp = 230.0, cash = 500.0
Output
"Fifty,One Hundred,One Hundred,Twenty"
Explanation
:O
public String calculateChange(float pp, float cash) {
  // write your code here
}
Input

pp

230.0

cash

500.0

Output

"Fifty,One Hundred,One Hundred,Twenty"

Sign in to submit your solution.