Nice idea you have.
I do think the code could be improved?
It makes the cost calculations easier.
Has error handling…
and rounds the final costs to 2 decimal places.
Just something you can consider.