0% found this document useful (0 votes)
20 views8 pages

Ealing Group 13 - Assignment 1

The document provides pseudocode for programming tasks involving calculating area and total materials needed for building houses, sorting an array of numbers in ascending order using bubble sort, and separating numbers in an array into even and odd categories by using a code to check if each can be divided by two. The pseudocode includes steps for inputting values, performing calculations like multiplication and modulus, and outputting results.

Uploaded by

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

Ealing Group 13 - Assignment 1

The document provides pseudocode for programming tasks involving calculating area and total materials needed for building houses, sorting an array of numbers in ascending order using bubble sort, and separating numbers in an array into even and odd categories by using a code to check if each can be divided by two. The pseudocode includes steps for inputting values, performing calculations like multiplication and modulus, and outputting results.

Uploaded by

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

Arden University

Computing With Foundation Year

Introduction To
Programming

STU97458

Taiwo Akinmuyisitan

554
Task 1:

As part of our building task, first we must start by determining the combined
area of a single room. Using a Calculate Area code we can determine the area
of a single room by inputting the values provided to us (2m x 4m).

Then after determining the amount of Metes of Wood each room will require,
we must multiply the total area of a room by the amount of rooms in a single
house to find out the total amount of Wood needed for a single house. To do
this we can use a Multiplication Code that will give us the result after imputing
the values we have, which in this case is the number of rooms (3) and meters
per room (8). And since all rooms are identical, the result won’t be impacted.
Then, after establishing the total number of meters per house, we can then use
the same code to find out the amount of meters for all five houses.
And finally, after receiving the total amount of meters of every house we can
then use the same code one last time to determine the cost of completing this
project, which in this case will be the number of total meters times the price of
one meter of wood.

Pseudocodes:

A) BEGIN B) BEGIN
Input Length Input number 1 & 2
Input Width Multiply N. 1 by N. 2
Multiply Length by Width Output
Output END
END
Task 2:

In order to arrange the values provided in the required order, we must use a
Bubble Sort code, which is the simplest type of sorting algorithm. Using Bubble
Sort we can arrange a given array in ascending order and this is done by taking
each number from first to last and comparing them to the one next to them, if
a number is greater than the one next to it, it is then swapped with the smaller
number.

After the code goes through each number and switches them, the array will be
given in ascending order from the smallest number to the highest.
Pseudocode:

A) BEGIN

loop = list.count;

for i = 0 to loop-1 do:

swapped = false

for j = 0 to loop-1 do:

compare the adjacent elements

If list[j] > list[j+1] then

swap them

swap( list[j], list[j+1] )

swapped = true

end if
end for

if no number was swapped that means array is sorted now

break

END procedure return list

Task 3:

To separate each number into their respective categories, we must use an Odd
Even Separation code, which will take any given array of numbers and check
each if each individual number it can be divided by two. If a number can be
divided it is moved to the first area where all even numbers are, if it cannot be
divided by two than it is moved to the last area where all odd numbers are.

If we scramble around these numbers for example, the program will be able to
recognise which is odd and which is even and arrange them in their respective
columns.
Pseudocode:

A) BEGIN
Input Numbers
Output as ‘Even Numbers’ if;
Number MOD 2= 0
Output as ‘Odd Numbers’ if;
Number MOD 2 does not = 0
Output
END

You might also like