Few years back, i was given an assignment to write a Pseudo Code for a specific scenarios. I have written the code together with the diagram for illustration of the codes. Anyway, now i have decided to release my written assignment paper here as it may help any other students that is learning on this subject. Anyway, Pseudo code is a compact and informal high-level description of a computer programming algorithm that uses the structural conventions of some programming language, but it is intended for human reading rather than machine reading.

PURPOSE

To master the problem solving phase in C programming.REQUIREMENT / ASSIGNMENT QUESTIONBunyan Lumber Company needs to create a table of the engineering properties of its lumber. The dimensions of the wood are measured as the base and the height in inches. Engineers need to know the following information about lumber:

Cross-Sectional Area=base×height

Moment of Inertia=(base ×〖height〗^3)/12

Section Modulus=(base×〖height〗^2)/6

The owner makes lumber with base sizes of 2, 4, 6, 8 and 10 inches. The height sizes are 2, 4, 6, 8, 10 and 12 inches. You are assigned to design a table with appropriate headings to show these values and the computed engineering properties. The first part of the table's outline is shown as:

Lumber Size Cross-Sectional Area Moment of Inertia Section Modulus

2 x 2

2 x 4

2 x 6

2 x 8

2 x 10

2 x 12

4 x 2

4 x 4

.

.

Based on the above programming problem:

1. Analyse the problem to identify required items to be used in designing algorithm

2. Write an algorithm in pseudo code

3. Draw a flowchart based on the pseudo code

4. Produce a tracing table to show the projected values

Note: You are not required to write programming codes for this assignment.ASSIGNMENT QUESTION for COMPUTER PROGRAMMING I (SEPTEMBER 2014)

### 1. PROBLEM ANALYSIS

**Q1 - Analyse the problem to identify required items to be used in designing algorithm.**

Bunyan Lumber Company needs to create a table of the engineering properties of its lumber. The dimensions of the wood are measured as the base and the height in inches. The owner makes lumber with base sizes of 2, 4, 6, 8 and 10 inches. The height sizes are 2, 4, 6, 8, 10 and 12 inches. You are assigned to design a table with appropriate headings to show these values and the computed engineering properties.

The first step in solving a problem is to identify Input and Output problems. Therefore, in this situation the data requirement for this scenario are as per following:

**Problem Input:**

Height |
Base |

(2, 4, 6, 8, 10 inches) | (2, 4, 6, 8, 10, 12 inches) |

**Problem Output:**

**Basically, we need to design a table based on the input above to project these output:**

1. Appropriate Table Headings

2. Lumber Size

3. Cross-Sectional Area

4. Moment of Inertia

5. Section of Modulus

**Relevant Formula:**

*above is not a formula, [x] is only character and to be as output as character

###
2. Write an algorithm in pseudo code.

Once the input and output problems has been identified together with relevant formula to produce the program, we can began on formulating the algorithm in pseudo code.

2.0 – Declare Base [i] and Height [j] as integer

3.0 – Set CSA = i x j // Cross-Sectional Area Formula

4.0 – Set MOI = i x j x j x j / 12 // Moment of Inertia Formula

5.0 – Set SM = i x j x j / 6 //Section Modulus Formula

6.0 – Print "Lumber Size" "Cross-Sectional Area" "Moment of Inertia" "Section Modulus"

// display table header

7.0 – Set total i = 0

8.0 – for (i = 2; <=10; increase i by 2) // base value increase by 2 with <= 10 condition

9.0 – Start_for // Start Counter Controlled Loop for base

9.1 – Set total j = 0

9.2 – for (j = 2; <12; increase j by 2) // height value increase by 2 with <=12 condition

9.3 – Start_for // Start Counter Controlled Loop for height

9.3.1 Print i "x" j // display lumber size (base x height) where "x" as char

9.3.2 Calculate CSA // execute CSA formula

9.3.3 Print CSA // display CSA result

9.3.4 Calculate MOI // calculate MOI formula

9.3.5 Print MOI // display MOI result

9.3.6 Calculate SM // calculate SM formula

9.3.7 Print SM // display SM result

9.3.8 Write newline ()

9.4 – End_for

10.0 – End_for

11.0 – End

##
3. Draw a flowchart based on the pseudo code.

Refer below for the flow-chart representing the program's algorithm written previously.

###
4. Produce a tracing table to show the projected values.

Refer below for the projected values based on the above algorithm:

Prof Dr Mansor Fadzil, (2014), CBCP2101 Computer Programming I, Open University Malaysia.

References

Few years back, i was given an assignment paper for my studies on **Basic Programming I**. The assignment paper was about an in-depth discussion about **how to write pseudo codes with diagrams**. I i have decided to publish my written articles here after one year from the assignment date. This is due to avoid any plagiarism issues that i might encountered if i publish this earlier than that.

You may download the published assignment paper here.