You are on page 1of 52

Bataan Peninsula State University

College of Engineering And Architecture


Department of mechanical engineering

CHAPTER 1
Introduction

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 1

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Background of the Studies


Being a mechanical engineering student requires a lot of effort and work on the
students part. In order to improve, they consider new concepts and ideas that become
more complex as they pursue the mechanical engineering course. This documentation
exhibits the functional aspects of the existing and currently used formulations and
computations involving Mechanical Engineering topics. The program contained inside
this documentation is given to further enhance the students capabilities on solving
important calculations needed in their program as well as to provide an effective
and convenient way of solving different problems.
Every complicated operation must have been based on something. Long computation
processes are always composed of simpler, shorter, and easy-to-solve solutions. To be
able to understand such complex ideas, an individual must have the understanding and
mastery of the small concepts behind it. This program is simply a solution for students
who have difficulties in computing several equations and problems. This project can be
beneficial to teachers and especially to students in a way that they can have a reference of
simple calculations used mostly in Mechanical Engineering subjects.
Objectives
General Objective
To do mechanical calculations faster
Specific Objectives

To lessen the time it takes to solve a given problem

To provide the mechanical engineering students a convenient way to


make the necessary computations

To make a program that can be used by instructors, particularly in the


checking of the answers

To get an accurate answer to computations

Scope and Limitations

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 2

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

This program only includes computations that can be used by


Mechanical Engineering students. Formulas and computations that are too
broad and not too familiar are not included in this program, only those that
are basic and used the most.

CHAPTER 2
Presentation
Of
Data

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 3

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Problem in existing system


This program is capable of solving some of the general mechanical
equations easier and is more accessible and applicable to students who find hard
in memorizing formulas. Itprovides the students to a quick, reliable, and accurate
answer to the given problem. Mechanical Engineering Calculator has preprogrammed formulas, translates them into worded options and executes the
operations based on the users chosen option.
The user himself can manipulate input of the program accordingly to his
preference. Both simple and complex formulas can be installed and/or re-installed
in the program using C++ programming language. This program is focused on
basic computations that mechanical engineering students normally encounter in
their program.
The Proposed System
<Physics/Mechanics>
Mechanics is the oldest branch of physics. It deals with the study on the
effects of forces on the bodies upon they act. Applied Engineering Mechanics concerns
itself mainly with applications of the principles of mechanics to the solution of problems
commonly met within the field of engineering practice, Mechanics is generally divided
into main branches of study as shown below:
MECHANICS
STATICS

DYNAMICS
KINEMATICS

KINETICS

Statics is the branch of mechanics which deals with forces and with the effects of forces
acting upon the rigid bodies at rest.

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 4

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Dynamics the branch of mechanics which deals with motion and with
the effects of forces acting on moving bodies.
Dynamics has two branches:
*Kinematics the study of motion without consideration of the forces
causing the motion.
*Kinetics the study of forces acting on the bodies in motion and their
effect in acceleration.
Physics is a natural science that involves the study of matter and
its motion through space and time, along with related concepts such
as energy and force. More broadly, it is the general analysis of nature, conducted in order
to understand how the universe behaves. Physics is one of the oldest academic
disciplines, perhaps the oldest through its inclusion of astronomy. Over the last two
millennia, physics was a part of natural philosophy along with chemistry, certain
branches of mathematics, and biology, but during the Scientific Revolution in the 17th
century, the natural sciences emerged as unique research programs in their own
right. Physics intersects with many interdisciplinary areas of research, such
as biophysics and quantum chemistry, and the boundaries of physics are not rigidly
defined. New ideas in physics often explain the fundamental mechanisms of other
sciences, while opening new avenues of research in areas such as mathematics and
philosophy.
Physics also makes significant contributions through advances in
new technologies that arise from theoretical breakthroughs. For example, advances in the
understanding of electromagnetism or nuclear physics led directly to the development of
new products which have dramatically transformed modern-day society, such
as television, computers, domestic appliances, and nuclear weapons; advances
in thermodynamics led to the development of industrialization; and advances
in mechanics inspired the development of calculus.
<Tension>

It is the pulling force exerted by a string, cable, chain, or similar solid object on
another object. It results from the net electrostatic attraction between the particles in a
solid when it is deformed so that the particles are further apart from each other than when
at equilibrium, where this force is balanced by repulsion due to electron shells; as such, it
is the pull exerted by a solid trying to restore its original, more compressed shape.
Tension is the opposite of compression. Slackening is the reduction of tension.

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 5

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

As tension is the magnitude of a force, it is measured in newtons (or


sometimes pounds-force) and is always measured parallel to the string on which it
applies. There are two basic possibilities for systems of objects held by strings: Either
acceleration is zero and the system is therefore in equilibrium, or there is acceleration and
therefore a net force is present. Note that a string is assumed to have negligible mass.

T (tension) = wy
Where: w Weight of the cable per unit length
y Height of the support

<Moment of force>

(Often just moment) is the tendency of a force to twist or rotate an object; see the
article torque for details. A moment is valued mathematically as the product of the force
and the moment arm. The moment arm is the perpendicular distance from the point of
rotation, to the line of action of the force. The moment may be thought of as a measure of
the tendency of the force to cause rotation about an imaginary axis through a

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 6

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

point. (Note: In mechanical and civil engineering, moment and torque have different
meanings, while in physics they are synonyms.

M (moment) = F x r
Where:

F force
r perpendicular distance

<Linear Distance>

Linear distance is basically the distance between two defined points. Think of two
pins on a map, and a string being strung from both heads, where the string would follow
from
one
point
to
another
in
a
perfect
line.
Hence, linear.
S (linear distance) = vt
Where:

v linear velocity
t time

<Work>

In physics, a force is said to do work when it acts on a body so that there is a


displacement of the point of application, however small, in the direction of the force.
Thus a force does work when there is movement under the action of the force.

W = Fs

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 7

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Where:

F force
S distance

<Power>

In physics, power is the rate at which energy is transferred, used, or transformed.


The unit of power is the joule per second (J/s), known as the watt (in honor of James
Watt,
the eighteenth-century developer of the steam engine). For example, the rate at which a
light bulb transforms electrical energy into heat and light is measured in wattsthe more
wattage, the more power, or equivalently the more electrical energy is used per unit time.

P (power) = w/t
Where:

w work

t time
<Potential Energy>
Potential energy is the energy of an object or a system due to the position of the
body or the arrangement of the particles of the system. The SI unit for measuring work
and energy is the Joule (symbol J).

The term "potential energy" was coined by the 19th century Scottish engineer and
physicist William Rankine, although it has links to Greek philosopher Aristotle's concept
of potentiality.

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 8

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

PE (Potential Energy) = mgh


Where: m mass
g specific gravity
<Kinetic Energy>

The kinetic energy of an object is the energy which it possesses due to its motion.
It is defined as the work needed to accelerate a body of a given mass from rest to its
stated velocity. Having gained this energy during its acceleration, the body maintains this
kinetic energy unless its speed changes. The same amount of work is done by the body in
decelerating from its current speed to a state of rest.
[1]

KE (kinetic energy) = mv
Where:
m mass
v velocity

<Strength of Materials>

Mechanics of materials, also called strength of materials is a subject which deals


with the behavior of objects withstanding stresses and strains.
The study of strength of materials often refers to various methods of calculating
stresses in structural members, such as beams, columns and shafts. The methods
employed to predict the response of a structure under loading and its susceptibility to
various failure modes may take into account various properties of the materials other than
strength of material and ultimate strength; for example, failure by buckling is dependent
on material stiffness and thus Young's Modulus.

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 9

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

<Stress>

Stress is often broken down into its shear and normal components as these have
unique physical significance. It often results from built up pressure due to the lack of an
outlet.
Stress can be applied to solids, liquids and gases. Static fluids support normal
stress (hydrostatic pressure) but will flow under shear stress. Moving viscous fluids can
support shear stress (dynamic pressure). Solids can support both shear and normal stress,
with ductile materials failing under shear and brittle materials failing under normal stress.
All materials have temperature dependent variations in stress related properties.

S (stress) = P/A
Where: P pressure
A area

<Power transmitted on the shaft>

P (power transmitted on the shaft) = 2TN/60

Where: N angular speed in RPM


T torque in N-m
P power in watts

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 10

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

<Thermodynamics>
Thermodynamics is a branch of physical sciences that treats various phenomena
of energy and the related properties of matter, especially of the laws of transformation of
heat into other forms of energy and vice-versa.
Thermodynamics is complementary to kinetic theory and statistical
thermodynamics. Thermodynamics provides relationships between physical properties of
any system once certain measurements are made. Kinetic theory and statistical
thermodynamics enable one to calculate the magnitudes of these properties for those
systems whose energy states can be determined.
<Absolute Pressure>
Absolute pressure is zero-referenced against a perfect vacuum, so it is equal to
gauge pressure plus atmospheric pressure.
Pabs = Pgage + Patm
<Density>
The mass density or density of a material is its mass per unit volume. The symbol
most often used for density is (the lower case Greek letter rho). Mathematically, density
is defined as mass.

<Weight Density>

The weight of a body or portion of a body divided by its volume.


= W/V
<Specific Volume>
The specific volume of a substance is the ratio of the substance's volume to its
mass. It is the reciprocal of density and is an intrinsic property of matter:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 11

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

<Specific Gravity>
Specific gravity is the ratio of the density (mass of a unit volume) of a substance
to the density (mass of the same unit volume) of a reference substance. Apparent specific
gravity is the ratio of the weight of a volume of the substance to the weight of an equal
volume of the reference substance. The reference substance is nearly always water for
liquids or air for gases. Temperature and pressure must be specified for both the sample
and the reference. Pressure is nearly always 1 atm equal to 101.325 kPa. Temperatures
for both sample and reference vary from industry to industry. In British brewing practice
the specific gravity as specified above is multiplied by 1000. Specific gravity is
commonly used in industry as a simple means of obtaining information about the
concentration of solutions of various materials such as brines, hydrocarbons, sugar
solutions
(syrups,
juices,
honeys,
brewers wort, must etc.)
and
acids.

S.G = gas/air = gas/air

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 12

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Program Language
Operators are symbols that perform specific mathematical, relational or logical
manipulation.

3 GENERAL CLASSES OF OPERATORS


1. ARITHMETIC / MATHEMATICAL OPERATORS + , - , * , /
Modulus Division Operator ( % ) or Remainder Operator
returns the integer remainder of the result
++ (increment) adds 1 to its operand ( x = x + 1 ->

x++)

- - (decrement) subtracts 1 to its operand ( x = x 1 ->

x--)

Rules for Evaluation of Arithmetic Expressions


a. All parenthesized expressions must be evaluated separately. Nested
parenthesized expressions must be evaluated from the inner most
parenthesized to the outer most parenthesized.
b. The operator precedence rule. Operator in the same sub expressions are
evaluated in the following order
1. positive ( + ) ornegative ( - )
2. *, /, %
3. +, 2. RELATIONAL AND LOGICAL OPERATORS
Relational Operators
a. Greater Than ( > )
b. Less Than ( < )
c. Greater Than or Equal To ( >= )
d. Less Than or Equal To ( <= )
e. Equal To ( = = )

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 13

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

f. Not Equal To ( != )
Logical Operators
a. Logical AND ( && ) the answer is TRUE if all of the statements are
TRUE; otherwise, it is FALSE.
b. Logical OR ( ) the answer is TRUE if one of the statements is TRUE;
otherwise, FALSE.
c. Logical NOT ( ! ) the answer is the reciprocal of the truth value.

3. BITWISE OPERATOR ( ^ ) the answer is


TRUEif
two statements are the same;
otherwise, it is FALSE.
IDENTIFIER
Identifiers are names that are used to reference variables, functions, labels, and
various user-defined objects
Rules for Valid Identifier
1. Meaningful names that starts with an alphabet.
2. Lowercase or Uppercase characters.
3. Numbers may be used within or at the end of the variable name.
4. The underscore ( _ ) may be used to come up with more meaningful names.
Invalid Identifier
1. Identifier that begins with number.
2. Mathematical operators that appear in an identifier.
3. Reserve and library words or identifiers.

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 14

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

I / O STATEMENTS
C/C++ treats all its output as though it were reading or writing to different files. A
file is really just an abstraction: a place where information comes from or can be sent to.
Some files can only be read, some can only be written to, others can be both read from
and written to. In other situations files are called I/O streams.
C/C++ has three files (also called streams) which are always open and ready for
use. They are called stdin (standard input), stdout (standard output) and stderr (standard
error) file. stdin is the input which usually arrives from the keyboard of a computer.
stdout is usually the screen. stderr is the route by which all error messages pass: usually
the screen.
The keyboard and screen are referred to as the standard input/output files because
this is what most people use, most of the time. Also the programmer never has to open or
close these, because C does it automatically. The C library functions covered by stdio.h
provide some methods for working with stdin and stdout.
DATA TYPES
Data Type is a set of values that a variable can store along with a set of
operations that can be performed on that variable.
5 Data Types
1. char used to hold ASCII characters or any 8-bit quantity
2. int used to hold integer quantities
3. float used to hold real numbers
4. double
(Real numbers have both an integer and fractional
component)
5. void valueless or declare a function as returning no value

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 15

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Start

Program Flowchart
an = Do you want to compute
again?
o = Select your option
p = Physics/Mechanics
q = Strength of Materials
r = Thermodynamics

Select option:
1. Physics/Mechanics
2. Strength of Materials
3. Thermodynamics

Input p, q , r

Yes

If o =1?

No

B
COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 16

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 17

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Select option:

Input w, y

1. Tension
2. Moment
3. Linear Distance
4. Work
5. Power
6. Potential Energy
7. Kinetic Energy
0. Back to Homepage

T (Tension) = w*y

Tension
D
If an
=
Y or N

Input w, y ,f ,v , t, s, h, m, g, x

Yes

Press Y or y

p=1
Yes

End

No
Press N or n

No
p=2

Yes
E

No

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 18

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Input f, x

M (Moment) = f*x

Moment
F

p=3

Yes

S (Linear Distance) = v*t


Input v, t

No
Linear Distance
P=4

Yes

Input f, s

No

D
W (Work) = F*s

Work

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 19

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

p=5

Power

Yes
Input w, t

P(power) = w/t

No

p=6

Yes

PE(Potential Energy) = m*g*h

Input m, g ,h

No

p=7

Potential Energy

Yes
Input m, v

No

p=0

KE(Kinetic Energy) = m*v

C
Kinetic Energy

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 20

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

o=2?

Select option:
Yes

1. Stress
2. Power Transmitted on the Shaft
0. Back to Homepage

No
Select option:
o=3?

Yes

No

1. Absolute Pressure
2. Density
3. Weight Density
4. Specific Volume
5. Specific Gravity
0. Back to Homepage

End

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 21

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

H
D

Input P, A, N, T
Stress

q=1

S (Stress) = P/A

Yes
Input P, A

No

q=2

Yes

Input T, N

P (Power Transmitted on the Shaft) = 2T*N/60

No
q=0

Power

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 22

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

I
D
Input a, b, c, d, e, g, i
Absolute Pressure

r=1

Yes

Input a, b

Pabs = a + b

No
Yes
Input c, d

r=2

Density = c/d

No

r=3

Density

Yes

Input e, d
Weight Density =e/d

No

D
K

Weight Density

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 23

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

r=4

Yes

Input d, c

Specific Volume =
d/c

No
Yes
r=5

Input g, i

No

Specific Vol.

D
r=0

S.G = g/i

Answer

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 24

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Program Source Code


#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<stdio.h>
#include<iomanip.h>

void main()
{
lablehome:
clrscr();

char an, o, p, q, r;
cout<<"\n\t\tWELCOME TO MECHANICAL ENGINEERING PROBLEMSOLVER!!!";
cout<<"\n\tSolve some General Problems in Mechanical Engineering Course easier!";
cout<<"\n\nSelect your option: \n\n";
cout<<"\
\n\t1.\tPhysics/Mechanics.\n\
\n\t2.\tStrength of Materials.\n\
\n\t3.\tThermodynamics.";

cout<<"\n\nSelect your option: ";


cin>>o;

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 25

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

clrscr();
switch (o)
{
case '1':
clrscr();
float w,y,f,v,t,s,h,m,g,x;
cout<<"\n\nSelect among the Options listed below: \n\n";
cout<<"\
\n\t1.\tTension.\n\
\n\t2.\tMoment.\n\
\n\t3.\tLinear Distance.\n\
\n\t4.\tWork.\n\
\n\t5.\tPower.\n\
\n\t6.\tPotential Energy.\n\
\n\t7.\tKinetic Energy.\n\
\n\t0.\tBack to Homepage.\n\ ";
cout<<"\n\n\Enter your Option: ";
cin>>p;
clrscr();

{
switch (p)
{
case'1':cout<<"Enter the weight of the cable: ";
cin>>w;
cout<<"Enter the height of the support: ";

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 26

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

cin>>y;
cout<<"Tension= "<<w*y;
break;
case'2':cout<<"Enter the value of Force: ";
cin>>f;
cout<<"Enter the perpendicular distance of force: ";
cin>>x;
cout<<"Moment= "<<f*x;
break;
case'3':cout<<"Enter the Linear velocity: ";
cin>>v;
cout<<"Enter the value of time in second/s: ";
cin>>t;
cout<<"Linear Distance= "<<v*t;
break;
case'4':cout<<"Enter the value of Force: ";
cin>>f;
cout<<"Enter the distance: ";
cin>>s;
cout<<"Work= "<<f*s;
break;
case'5':cout<<"Enter the value of work: ";
cin>>w;
cout<<"Enter the value of time in second/s: ";
cin>>t;
cout<<"Power= "<<w/t;

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 27

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

break;
case'6':cout<<"Enter the value of mass: ";
cin>>m;
cout<<"Enter the value of gravity: ";
cin>>g;
cout<<"Enter the value of height: ";
cin>>h;
cout<<"Potential Energy= "<<m*g*h;
break;
case'7':cout<<"Enter the value of mass: ";
cin>>m;
cout<<"Enter the Velocity: ";
cin>>v;
cout<<"Kinetic Energy= "<<(m*v*v)/2;
break;
case'0':
labelwr4:
{clrscr();gotolablehome;}

default:
cout<<"INVALID!";
break;
}

labelwr:
cout<<"\n\nDo you want to compute again?(y or n)\n";

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 28

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

cin>>an;
if(an=='y' || an=='Y')
{gotolablehome;}
else if (an=='n' || an=='N')
{clrscr(); cout<<"\t\t\tThank you for using the Program!";}
else
{clrscr(); cout<<"INVALID!"; gotolabelwr;}
getch();
}

getch();
break;

case '2':
clrscr();
float P,A,N,T;
cout<<"\n\nSelect among the Options listed below: \n\n";
cout<<"\
\n\t1.\tStress.\n\
\n\t2.\tPower transmitted on the Shaft.\n\
\n\t0.\tBack to Homepage.\n\ ";
cout<<"\n\nEnter your option: ";
cin>>q;
clrscr();
{

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 29

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

switch (q)
{

case'1':cout<<"Enter the value of Pressure: ";


cin>>P;
cout<<"Enter the Area: ";
cin>>A;
cout<<"Stress= "<<P/A;
break;
case'2':cout<<"Enter the value of Angular Speed in RPM: ";
cin>>N;
cout<<"Enter the Torque value (N.m): ";
cin>>T;
cout<<"Power (in watts)= "<<(2*3.1416*T*N)/60;
break;
case'0':
labelwr5:
{clrscr(); gotolablehome;}

default:
cout<<"INVALID!";
break;
}

labelwr1:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 30

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

cout<<"\n\nDo you want to compute again?(y or n)\n";


cin>>an;
if(an=='y' || an=='Y')
{gotolablehome;}
else if (an=='n' || an=='N')
{clrscr(); cout<<"\t\t\tThank you for using the Program!";}
else
{clrscr(); cout<<"INVALID!"; goto labelwr1;}
getch();
}
getch();
break;
case '3':
{
clrscr();
floata,b,c,d,e,g,i;
cout<<"\n\nSelect among the Options listed below: \n\n";
cout<<"\
\n\t1.\tAbsolute Pressure.\n\
\n\t2.\tDensity.\n\
\n\t3.\tWeight Density.\n\
\n\t4.\tSpecific Volume.\n\
\n\t5.\tSpecific Gravity.\n\
\n\t0.\tBack to Homepage.\n\ ";

cout<<"\n\n\nEnter your Option: ";

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 31

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

cin>>r;
clrscr();
{
switch (r)
{
case '1':cout<<"Enter the value of Gage Pressure: ";
cin>>a;
cout<<"Enter the value of Atmospheric Pressure: ";
cin>>b;
cout<<"Absolute Pressure= "<<a+b;
break;
case '2':cout<<"Enter the value of mass: ";
cin>>c;
cout<<"Enter the value of volume: ";
cin>>d;
cout<<"Density= "<<c/d;
break;
case '3':cout<<"Enter the value of weight: ";
cin>>e;
cout<<"Enter the volume: ";
cin>>d;
cout<<"Weight Density= "<<e/d;
break;
case '4':cout<<"Enter the mass: ";
cin>>c;
cout<<"Enter the volume: ";

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 32

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

cin>>d;
cout<<"Specific Volume= "<<d/c;
break;
case '5':cout<<"Enter the Specific Weight of Gas: ";
cin>>g;
cout<<"Enter the Specific Weight of Air: ";
cin>>i;
cout<<"Specific Gravity= "<<g/i;
break;
case '0':
labelwr6:
{clrscr();gotolablehome;}

default:
cout<<"INVALID!";
break;
}

labelwr2:
cout<<"\n\nDo you want to compute again?(y or n)\n";
cin>>an;
if(an=='y'||an=='Y')
{gotolablehome;}
else if(an=='n'||an=='N')
{clrscr(); cout<<"\t\t\tThank you for using the Program!" <<endl;}
else

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 33

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

{clrscr(); cout<<"\nINVALID!";goto labelwr2;}

getch();
}
default:
cout<<"INVALID SELECTION!";
labelwr3:
cout<<"\n\nBack to homepage?(y or n)\n";
cin>>an;
if(an=='y'||an=='Y')
{gotolablehome;}
else if(an=='n'||an=='N')
{clrscr(); cout<<"\t\t\tThank you for using the Program!"<<endl;}
else
{clrscr();cout<<"INVALID SELECTION!";goto labelwr3;}
getch();
break;
}
}
getch();
clrscr();
}

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 34

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

Program Output
HOME PAGE:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 35

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

PHYSICS/MECHANICS:

SOLVING TENSION:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 36

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING MOMENT:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 37

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR THE LINEAR DISTANCE:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 38

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR WORK:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 39

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR POWER:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 40

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR POTENTIAL ENERGY:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 41

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR KINETIC ENERGY:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 42

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

STRENGTH OF MATERIALS:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 43

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR STRESSES:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 44

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR THE POWER TRANSMITTED ON THE SHAFT:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 45

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

THERMODYNAMICS:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 46

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR ABSOLUTE PRESSURE:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 47

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING DENSITIES:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 48

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING FOR WEIGHT DENSITY:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 49

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING SPECIFIC VOLUME:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 50

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

SOLVING SPECIFIC GRAVITIES:

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 51

Bataan Peninsula State University


College of Engineering And Architecture
Department of mechanical engineering

INVALID INPUTS (FAULT/ERROR PAGE)

END PAGE

COMPUTER FUNDAMENTALS AND PROGRAMMING

PAGE 52