Problem Solving for Programming Example 1 – Solution Sub-problems: 1) Calculate how many miles the vehicle can travel on 50.00 worth of fuel when fuel is 5.20 per gallon? a. How much fuel is there? b. How many miles can the vehicle travel on that amount of fuel? c. Convert answer in miles to answer in kilometres. 2) Calculate how many miles the vehicle can travel on 50.00 worth of fuel when fuel is 5.50 per gallon? a. How much fuel is there? b. How many miles can the vehicle travel on that amount of fuel? c. Convert answer in miles to answer in kilometres. Knowns: Vehicle fuel capacity (15 gallons). Vehicle fuel consumption (40 miles per gallon). Price of gas (5.20 and 5.50). Unknowns: How to calculate number of miles the vehicle can travel on stated amounts of fuel. How to convert miles to kilometres. What kind of vehicle it is. Ambiguity: Is gas the same thing as fuel? Are we dealing with US or UK gallons? What is the currency being used? Assumptions: Gas is the same thing as fuel. We are dealing with UK gallons. We are dealing with UK £s. Extraneous information: The car fuel capacity. Problem type: Simple mathematical problem Answers: 1) Vehicle can travel 618.99 kilometres on 50.00 worth of fuel when fuel is 5.20 per gallon. 50/5.20 = 9.62 9.62 * 40 = 384.62 Miles Miles to Kilometres = 3.84.62 * 1.60934 = 618.99 2) Vehicle can travel 585.21 kilometres on 50.00 worth of fuel when fuel is 5.50 per gallon. 50/5.50 = 9.09 9.09 * 40 = 363.63 Miles Miles to Kilometres = 363.63 * 1.60934 = 585.21
© Copyright 2026 Paperzz