A1_2010_sol - Assignment 1 Solution Q1 GIVENS: TotalCost...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 3

A1_2010_sol - Assignment 1 Solution Q1 GIVENS: TotalCost...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online