Case Study: Converting Miles to KilometersPROBLEMYour summer surveying job requires you to study some maps that gives 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.ANALYSISThe 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. Therefore, the problem input is distance in milesand the problem output is distance in kilometers. To write the program, you need to know the relationship between miles and kilometers. Consulting a metric table shows that one mile equals 1.609 kilometers.The data requirements and relevant formulas are listed below. milesidentifies the memory cell that will contain the problem input and kmsidentifies the memory cell that will contain the program result, or the problem output.Data RequirementsProblem Inputmiles# the distance in milesProblem Outputkms# the distance in kilometersRelevant Formula1 mile = 1.609 kilometers
DESIGNNext, formulate the algorithm that solves the problem. In this case, flowchart is being used as the algorithm to solve the problem.Read Distance_in_MilesConvert the distance to kilometersDistance_in_KM =Distance_in_Miles * 1.609BeginDisplay Distance_in_KMEndIMPLEMENTATIONTo implement the solution, you must write the algorithm as a python program. To do this, you must first tell the python compiler about the problem data requirements –that is, what memory cell names you are using and what kind of data will be stored in each memory cell. Next, convert each algorithm step into one or more python statements. If an algorithm step has been refined, you must convert the refinements, not the original step, into python statements.Figure below shows the python program along with a sample execution. For easy identification, the program statements corresponding to algorithm steps are in color as is the input data typed in by the program user.