-3

Task 1 Pseudo code
Design program logic using pseudo code for the following cases:

(a) You are given an array with the following data

Apple Orange Mango Tomato Banana Grape Plume Peach Honeydew Papaya

Create an array, fruitStore, of size 10. Transfer all the fruits from the array above to the fruitStore array iteratively.

(b) Read the elements in the array fruitStore above one by one, if a fruit’s name begins with O or P, print the name of the fruit.

(c) Calculate and print how many types of fruits are yellow in color when they are ripen.

(d) Using iteration construct to print the fruits in the position of 1, 4 and 7 of fruitStore array.

(e) Reverse the sequence of the fruits in the array, fruitStore.

Note: No additional array should be created in part (e).


Task 3 Data file processing

Assume some numbers in random order to a file, “number.txt”. Numbers are separated by space. You need to use pseudo code performing the following tasks.

1. Read each number from the data file. (You need to check when there was no data left in the file)
2. Print all the the numbers that multiple of 5. Number will be printed in six numbers in a line
3. Print all the odd numbers and the sum of all the even numbers.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Nick Evan
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.