Extra CreditOptional. Not required for any homework drop.
I am driving to my cousin's this weekend and I want to knowwhat the gas is going to run me before I commit. My car ispretty good on gas but I do not remember the exact number,so I would rather type it in each time than have it built in.One thing though: the pump rounds. I buy 13.1 gallons, not13.125 gallons, and the price I actually pay is based on therounded number. Give me a total that matches what my receiptwould actually say.Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.
int.Parse or double.Parse before you can do arithmetic with it..ToString("F1") returns text, not a number. If you multiply that text by a price and get something strange — or it refuses to compile at all — that is this note, arriving early.How far are you driving (miles)? 420What is your car's mpg? 32Price per gallon? 3.49
Gallons needed: 13.125Gallons (rounded): 13.1Trip cost: $45.72Round after multiplying instead of before and the same inputs give 45.81 — verified in a real run. That nine-cent difference, and where it comes from, is the whole point of this challenge.
Your requirements list and your program file, named cc-fuel-calculator.