0% found this document useful (0 votes)
39 views42 pages

MPD445 - Lecture 01 - 252

The document outlines a course on computer applications in planning, analysis, and control, focusing on tools like C++, MS Excel, and MS Project. It covers project planning techniques, performance evaluation, and productivity metrics, along with evaluation criteria for students. Additionally, it includes references, programming concepts, and practical examples related to C++ and Excel functionalities.

Uploaded by

Mahmoud Essam
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)
39 views42 pages

MPD445 - Lecture 01 - 252

The document outlines a course on computer applications in planning, analysis, and control, focusing on tools like C++, MS Excel, and MS Project. It covers project planning techniques, performance evaluation, and productivity metrics, along with evaluation criteria for students. Additionally, it includes references, programming concepts, and practical examples related to C++ and Excel functionalities.

Uploaded by

Mahmoud Essam
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/ 42

MECHANICAL ENGINEERING

DEPARTMENT
4th year Production

MDP445
Computer in Planning,
Analysis and Control

Lecture: 1
Introduction to computer applications

Dr. Sayed Ali Zayan 2nd Term 2024/2025


Topics:
 Introduction to computer applications (C++ - MS Excel –
MS Project - … etc.)
 Project planning techniques
 Performance evaluation techniques.
 Productivity metrics
 Using the computer in production planning & control.
 Using the computer in project planning
 Using the computer in project performance analysis.
 Using the computer in productivity measures.
 Using the computer in productive resources planning
and analysis.
 Case studies.
Evaluation:
Final Exam 80 Points
Mid term Exam 20
Lab Work (Lab, Assign. , Attend., etc.) 15
Lecture work (Reports, Quizzes, Attend.) 10
Total 125
References:
1) Malik D. S.
“C++ Programming: from problem analysis to program design”
6th ed., 2013 by Cengage Learning.
2) Powell S. G. & Baker K. R.
“Management Science: The art of Modeling with spreadsheets”
2009 by John Wiley & Sons Inc.
3) Winston W. L.
“Microsoft Excel 2013: Data Analysis & Business Modeling”
2014 by Wayne L. Winston
4) Khan R. M.
“Problem solving & Data analysis using Minitab”
2013 by John Wiley & Sons Inc.
Computer Applications:
high level language programming
C++ (use compiler: DevCPP_5.1 or 6.3)
Spreadsheet
Microsoft Excel (2013, 2016, 2019, …..)
Computer software Packages
QM : Quantitative Management
Lekin- Scheduler
Microsoft Project or Primavera
Minitab or SPSS
Review for computer programming C++
1.1 Problem Solving Steps
 Defining the problem
 Problem analysis
 Program coding
 Program execution and testing
1.2 Algorithm concept:
 Natural Languages
 Flow charts
 Pseudo code
Using Flow Charts Example:
Draw the flow chart to calculate the
price of product, after adding the
The Symbols: sale tax. Where the sale tax add if the
product price equal to or greater
Begin or End Read or Write than $100. Take sale tax 5%.

Processing Decision

Looping Connection

Branched algorithm

Arrows
Software Development

Write Source
Source Code File

Object
Compile File
Errors
Executable
Link File
Errors

Test
Errors
Program Stages

myprog.cpp myprog.obj myprog.exe


SOURCE OBJECT EXECUTABLE
written in
written in written in
machine
C++ machine
language
language

via compiler via linker

other code
from libraries,
etc.
Simplest C++ Program

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main (void)
{

return 0;
}
C++ Data Types
Simple
Address

Integral Floating pointer reference

Structured
char short int long enum
float double long double array struct union class

Examples:
What Does a Variable Declaration Do?
A declaration tells the compiler to allocate enough memory to hold a
int age; value of this data type, and to associate the identifier with this location.
float tRate;
char middle;
4 bytes for tRate 1 byte for Middle
Program Example

#include <iostream> //Include I/O library


Using namespace std;
const float d = 7.0;
const float m = 29.0;

int main ()
{
float a;
a=m*d;
cout << “a= “ << a << endl;
return 0;
}
Variable Declaration by array:
4000 4002 4004
int bp1, bp2, bp3;
int total;
bp1 bp2 bp3
cin >> bp1 >> bp2 >> bp3;
total = bp1 + bp2 + bp3;

What if you wanted to store and total 1000 blood pressures?

int bp[ 1000 ] ; // declares an array of 1000 int values

Called one dimension array


Another Example
Declare an array called temps which will
hold up to 5 individual float values.
number of elements in the array

// declaration allocates memory float temps[5];

Base Address

7000 7004 7008 7012 7016

temps[0] temps[1] temps[2] temps[3] temps[4]

indices or subscripts
Assigning values to individual array elements
float temps[ 5 ] ; // allocates memory for array
int m=4;
temps[ 2 ] = 98.6 ;
temps[ 3 ] = 101.2 ;
temps[ 0 ] = 99.4 ;
temps[ m ] = temps[ 3 ] / 2.0 ;
temps[ 1 ] = temps[ 3 ] - 1.2 ; // what value is
assigned?
7000 7004 7008 7012 7016

temps[0] temps[1] temps[2] temps[3] temps[4]


Initializing in a declaration
int ages[ 5 ] = { 40, 13, 20, 19, 36 } ;

for ( int m = 0; m < 5; m++ ) {


cout << ages[ m ] ;
} // end for

6000 6002 6004 6006 6008

40 13 20 19 36

ages[0] ages[1] ages[2] ages[3] ages[4]


Two-Dimensional Array
is a collection of components, all of the same type,
structured in two dimensions, (referred to as
rows and columns). Individual components are
accessed by a pair of indexes representing the
component’s position in each dimension.
SYNTAX FOR ARRAY DECLARATION

DataType ArrayName [ConstIntExpr] [ConstIntExpr] . . . ;

Examples:
int x[3][4];
float m[5][5]
EXAMPLE -- To keep monthly high temperatures for
all 50 states in one array.

const int NUM_STATES = 50 ;


const int NUM_MONTHS = 12 ;
int stateHighs [ NUM_STATES ] [ NUM_MONTHS ] ;

[0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]
[0]
[1]
[2]
row 2, 66 64 72 78 85 90 99 105 98 90 88 80
.
col 7
might be . stateHighs [2] [7]
Arizona’s .
high for [ 48 ]
August [ 49 ]
Input/Output Statements
Input Statement:

cin >> Variable >> Variable . . . ;


These examples yield the same result.
cin >> length ;
cin >> width ;
cin >> length >> width ;
Output Statement:

cout << ExprOrString << ExprOrString . . . ;


These examples yield the same output.
cout << “The answer is “ ;
cout << 3 * 4 ;
cout << “The answer is “ << 3 * 4 ;
What is exact output?
#include <iomanip>
#include <iostream>
Using namespace std;
int main ()
{
float myNumber = 123.4587 ;

cout << “Number is ” << setprecision ( 3 )


<< myNumber << endl ;

return 0 ;
} //end of main
Sequential Programming

Statement1 int main(void)


{
Statement2
Statement1;
Statement2;
Statement3;
Statement3 }
Program Branching

TRUE FALSE
expression

if clause else clause

6 Relational Operators
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
== Equal to
!= Not equal to
NESTED if statements
if ( Expression1 ) {
StatementList1
} else if ( Expression2 ) {
StatementList2
} else if
...
} else if ( ExpressionN ) {
StatementListN
} else {
StatementList N+1
}

EXACTLY 1 of these statements will be executed.


The switch statement
switch( Day ) {
case 1:
cout << "Sunday ";
break;
case 2:
cout << "Monday";
break;
...
case 7:
cout << "Saturday ";
break;
default:
cout << "Day number is not handled.";
break;
}
C++: Loops
A loop is a repetition control structure.

it causes a single statement or block to be executed repeatedly

For loops
It is very good for definite loops
All the parts (priming, testing and updating) are in one place.
format:
for (prime expression; test expression; update expression)
SYNTAX

for ( initialization ; test expression ; update )


{
Body of loop;

}
initialization
For Loop diagram
false
Expression update

true

Body of loop
Example: Nested For Loops
#include <iostream>
#include <iomanip>
Using namespace std;
Output:
main ()
{ *
Outer Loop
int rows, columns; **
***
for (rows=1; rows<=5; rows++)
****
{
for (columns=1; columns<=rows; columns++) *****
cout<<"*";
Inner Loop
cout<<endl;
}
return 0;
}
While Statement

SYNTAX

while ( Expression )
{
.
. // loop body
.
}

NOTE: Loop body can be a single statement, a null


statement, or a block.
Do-While Statement
Is a looping control structure in which the loop condition is tested
after each iteration of the loop.

SYNTAX
do
{
Statements;

} while ( Expression ) ;

Loop body statement can be a single statement or a block.


Entering Data to Two Dimensional Array
for(i=0;i<rows;i++)
for(j=0;i<columns; j++)
cin>> a[i][j];
Print the Two Dimensional Array
for(i=0;i<rows;i++)
{
for(j=0;i<columns; j++)
cout<< a[i][j];
cout<<endl;
}
Review for the Spreadsheet (MS Excel)
 A spreadsheet is an electronic file that contains a grid of
columns and rows used to organize related data and to display
results of calculations, enabling interpretation of quantitative
data for decision making.
 In Excel, a worksheet is a single spreadsheet that typically
contains descriptive labels, numeric values, formulas, functions,
and graphical representations of data. A workbook is a
collection of one or more related worksheets contained within a
single file.
 By default, new workbooks contain one worksheet. Storing
multiple worksheets within one workbook helps organize related
data together in one file and enables you to perform
calculations among the worksheets within the workbook.
 Like other Microsoft Office programs, the Excel window contains
the Quick Access Toolbar, the title bar, sizing buttons, and the
Ribbon. In addition, Excel contains unique elements.
Review for the Spreadsheet (MS Excel)

Excel window
Review for the Spreadsheet (MS Excel)
Excel Functions Review
Excel function is a special type of formula that produces, or “returns” a specific result.

Function Elements
All functions are made up of two elements:
Function name
Argument list
Max. 30

=Function Name (Argument)


=Function Name ( Arg1, Arg2,…….,ArgN)
=Function Name ( )
Examples: =SUM(A1:A15) Separated by
Empty commas
= RAND( ) argument list
Review for the Spreadsheet (MS Excel)
Function Categories
1. Math & Trig functions (e.g. sum, power, fact, sqrt, rand, ….etc.)
2. Logical functions (if, and, or,….etc.)
3. Lookup and Reference functions (choose, vlookup, …etc.)
4. Statistical functions (average, max, min, countif,……etc.)
5. Financial functions (PMT, Rate, PV, …etc.)
6. Date & Time functions (Now, today, …….etc.)
7. Text functions (find, lower, replace,….etc.)
8. Information functions (cell, error, type, isblank,…etc.)
9. Engineering functions (complex, convert, …etc.)
10.User-Defined functions
11.Analysis ToolPack functions
Review for the Spreadsheet (MS Excel)
The Goal Seek Command
To use Goal Seek, complete the following steps:
1. Click What-If Analysis in the Forecast group on
the Data tab.
2. Select Goal Seek to open the Goal Seek dialog
box.
3. Enter the cell reference for the cell to be
optimized in the Set cell box. This cell must contain
a formula, such as the monthly payment.
4. Enter the result you want to achieve (such as the
$800 goal) in the To value box.
5. Enter the cell reference that contains the variable
to adjust (such as the down payment) in the By
changing cell box as shown in Figure. This cell must
be a value, not a formula, which has a
mathematical relationship with the cell containing
the formula or goal.
6. Click OK.
Excel Solver:
Add-ins are programs that can be added to Excel to provide
enhanced functionality.
Solver is an add-in application that searches for the best or optimum
solution to a problem by manipulating the values for several variables
within restrictions that you impose. You can use Solver to create
optimization models.
To load Solver, complete the following steps:
• Click the File tab and select Options.
• Click Add-ins to see a list of active and inactive add-
in applications. The Active Application Add-ins list
displays currently enabled add-ins, and the Inactive
Application Add-ins list displays add-ins that are not
currently enabled.
• Click the Manage arrow at the bottom of the dialog
box, select Excel Add-ins, and then click Go to open
the Add-ins dialog box (see Figure).
• Click the Solver Add-in check box in the Add-ins
available list and click OK.
Excel Solver:
To specify the objective and changing cells,
complete the following steps:
1. Click Solver in the Analyze group on the
Data tab to open the Solver Parameters dialog
box (see Figure).
2. Enter the cell containing the formula for
which you want to optimize its value in the Set
Objective box.
3. Click an option in the To section to specify
what type of value you need to find for the
target cell. Click Max to maximize the value,
Min to find the lowest value, or Value Of, and
then specify the value in the Value Of box.
4. Enter the cell references that contain
variables in the By Changing Variable Cells
box. These are the variables that you want to
change to reach the objective.
Excel Solver:
To add constraints to the Solver, complete the following steps:
1. Click Add to the right of the Subject to the Constraints list in Solver
Parameters to open the Add Constraint dialog box.
2. Enter the cell reference, the operator to test the cell reference, and the
constraint the cell needs to match (see Figure). The cell reference contains a
variable whose value you want to constrain or restrict to a particular value or
range. The operator defines the relationship between the variable and the
constraint.
3. Click OK to add the constraint and return to the Solver Parameters dialog
box, or click Add to add the constraint and create another constraint.
TreePlan:
 TreePlan is an Excel add-in program developed by Michael
Middleton that can be obtained from Decision Tool Works to
construct and solve decision trees in an Excel spreadsheet format.
Although Excel has the graphical and computational capability to
develop decision trees, it is a difficult and slow process. TreePlan is
basically a decision tree template that greatly simplifies the process
of setting up a decision tree in Excel.
END
Lecture
You can win, if you want

You might also like