This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Assignment 1 Solution Q1 GIVENS: TotalCost (total cost of gas, in dollars) CostPerLitre (cost of gas in cents per litre) RESULT: Litres (number of litres you bought) Km (number of km you can drive ) Miles (equivalent miles) INTERMEDIATE LitresPer100Km (consume of gas) KmToMiles (transformation km into miles) HEADER: (Litres, Km, Miles) ← CostKm&Miles(TotalCost, CostPerLitre) BODY: 1. LitresPer100Km = 7 2. KmToMiles = 0.62 3. Litres = TotalCost / CostPerLitre * 100 4. Km = Litres / LitresPer100Km * 100 5. Miles = Km * KmToMiles Q2 /** * ITI 1120 - Winter 2010, Assignment 1, Question 2 * Name: Diana Inkpen, student number: 7654321 * * This program displays the assignment and question number and * the name and student number of the author. * It takes as input the amount of dollars spent on gas and the cost per litre. * It computers how much gas you bought, * how many km you can drive, and how much is that in miles....
View Full Document
This note was uploaded on 01/06/2011 for the course CSI 1120 taught by Professor Inkpen during the Fall '07 term at University of Ottawa.
- Fall '07