Flow Chart Start: Input Mass Input Distance

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

FLOW CHART

START

LENGTH
OR MASS?

INPUT DISTANCE INPUT MASS

Cm = in*2.54 g = kg*1000

In = ft*12 kg = lb/2.2

Ft = cm/30.48 lb = g/453.592

PRINT PRINT

Cm,in,ft g,kg,lb

END
PROBLEM

Engineering students are assigned to convert unit of measurements from SI to English


or vice versa. The given are centimeter to inches or feet and grams or kilograms to
pound.

PURPOSE/USE OF THE PROBLEM IN ENGINEERING FIEND

In engineering field unit conversion is important so that you can convert standard units
from one form to another according to the requirement. The need for the basic
conversion has always existed in this field for different purposes. Conversion of Si to
English or vice versa is also important in this field. Other counties are using different
kind of measurements. As an engineer, if you encounter this kind of problem you can
easily convert one unit to another in order to fulfill your desire or what is it required.

SCRIPT

clc
clear all
d= input('Enter the Input Distance');
i= input('Enter the input(cm,in,ft): ');
o= input('Enter output units to convert to(cm,in,ft): ');
switch i
case 'cm'
if o=='in'
x=d/2.54;
else
if o=='ft'
x=d/30.48;
else
if o=='cm'
x=d
end
end
end
case 'in'
if o=='in'
x=d;
else
if o=='ft'
x=d/12;
else
if o=='cm'
x=2.54*d;
end
end
end
case 'ft'
if o=='in'
x=d*12;
else
if o=='ft'
x=d;
else
if o=='cm'
x=d*30.48;
end
end
end
str = fprintf('%d %s = %d %s',d,i,x,o);
otherwise
disp('wrong input');
end

d= input('Enter the Input Mass');


i= input('Enter the input(g,kg,lb): ');
o= input('Enter output units to convert to(g,kg,lb): ');
switch i
case 'g'
if o=='kg'
x=d/1000;
else
if o=='lb'
x=d/453.592;
else
if o=='g'
x=d
end
end
end
case 'kg'
if o=='kg'
x=d;
else
if o=='lb'
x=d*2.20462;
else
if o=='g'
x=d*1000;
end
end
end
case 'lb'
if o=='kg'
x=d/2.20462;
else
if o=='lb'
x=d;
else
if o=='g'
x=d/453.592;
end
end
end
str = fprintf('%d %s = %d %s',d,i,x,o);
otherwise
disp('wrong input');
end
NEGROS ORIENTAL STATE UNIVERSITY
COLLEGE OF ENGINEERING AND ARCHITECTURE
MAIN CAMPUS II, BAJUMPANDAN, DUMAGUETE CITY

ENS 322

COMPUTER FUNDAMENTALS AND PROGRAMMING

(T-TH/1:00-2:30)

Submitted by:

Lianne Von F. Cabacang

Jasper Van Arrieta

Submitted to:

Engr. Lynette E. Dorio

You might also like