0% found this document useful (0 votes)
7 views6 pages

Problem Solving - Problem 1

Uploaded by

redunikorn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views6 pages

Problem Solving - Problem 1

Uploaded by

redunikorn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Problem Solving – Problem 1

Problem Statement :

Your summer surveying job requires you to study


some maps that give distances in miles. You and
your co-workers prefer to deal in metric
measurements (km). Write a program that
performs the necessary conversion. The
program will display the distance in km.
Formula: (1 mile = 1.609 kilometers)

5
1. Understand the problem:
 Statement to highlight: Your summer
surveying job requires you to study some maps
that give distances in miles. You and your
coworkers prefer to deal in metric
measurements (km). Write a program that
performs the necessary conversion. The
program will display the distance in km.
Formula: (1 mile = 1.609 kilometers)
What are the INPUTs ??? What are the OUTPUTs ???

What are the PROCESSes ???


6
 Input
 the distance in miles
(M)

 Output
 the distance in kilometers
(K)

 Process (or formula)


 1 mile = 1.609 kilometers
 K = M x 1.609
7
Structure Chart
(if using top-down design)

Main Problem

Convert the Display the


Input the distance
distance in miles distance in
in miles
to kilometers kilometers

8
2. Design the solution (or Algorithm):
Algorithm is a step-by-step problem solving process in which a
solution is arrived at in a finite amount of time.

Algorithm can be designed using:


a) Pseudocode or
b) Flowchart

9
a) Pseudocode
 Precise algorithmic description of program logic
 Its purpose is to describe, in precise algorithm
detail, what the program being design is to do.
 Requires the defining the steps to accomplish the
task in sufficient detail so that they can be
converted into a computer program.

10

You might also like