Goals - to use the MU computer
facilities - to use the editor - to use the compiler
Overview
For this assignment, you will write a program to
Convert Miles to Kilometers.
Problem Description
•Case Study:Converting Miles to Kilometers
–Problem Your
summer surveying job requires you to study some maps that give distances in
kilometers and some that use miles. You and your coworkers prefer to deal in
metric measurements. Write a program that performs the necessary conversion.
Analysis The
first step in solving this problem is to determine what you are asked to
do. You must convert from one system of measurement to another, but are
you supposed to convert from kilometers to miles, or vice versa? The
problem states that you prefer to deal in metric measurements, so you must
convert distance measurements in miles to kilometers.
•Problem
Input
milesdistance in miles
•Problem Output
kmsthe distance in kilometers
•Relevant Formula
1 mile = 1.609 kilometers
•Formulate the algorithm that solves the problem.
•Algorithm
1. Get the
distance in miles.
2. Convert the
distance to kilometers.
3. Display the
distance in kilometers.
•Algorithm Refinement
2.1 The
distance in kilometers is 1.609 the distance in miles
•
When you are done with the program, print it out
and hand it in.