Question On Algorithms
Question On Algorithms
Draw a flowchart for a program that is to prompt for 10 numbers, accumulate the sum and them find the
average. The output is the accumulated totals and the average.
Write a pseudo code that reads temperature for each day in a week, in degree Celsius, converts the
celcius into Fahrenheit and then calculates the average weekly temperatures. The program should
output the calculated average in degrees Fahrenheit. (To convert temperatures in degrees Celsius
to Fahrenheit, multiply by 1.8 and add 32.)
Michael deposits 1,000 in a bank at an interest rate of 10% per year. At the end of each year, the interest
earned is added to the deposit and this becomes the new deposit for the next year.
Develop a pseudo code to determine the year in which the amount accumulated first exceeds 2,000.
Also for each year, print the year (starting from 1), the deposit, the Interest earned, and the total
accumulated at the end of the year.
Mwalimu savings society (MSS) Pays 5% interest on shares exceeding 100,000 shillings and 3% on shares
that do not meet this target. However, no interest is paid on deposits in the member’s MSS bank
account
a) Design a pseudo code for a program that would:
i) Prompt the user for shares and deposit of particular members
ii) Calculate the interest and total savings
iii) Display the interest and total savings on the screen for particular members of the society.
b) Draw a flowchart for the above pseudo code.
The gross salary of employees of Mutson Chemist is based on the Basic and additional benefits.
Employees with more than 10 year’s experience get an additional pay of 10% of their basic salary.
Bonuses are given as per employees’ sales of the month as:
>200,000 15%
100,000 – 200,000 10%
Below 100,000 5%
Draw a flowchart for the program that will calculate Gross salary and output each employee’s Basic
salary, gross salary and all benefits. (15 mks)
Using pseudo code or otherwise, write an algorithm which will take information about each
transaction at a supermarket till, calculate and output
• the number of sales,
• the number of refunds,
• the total amount of money in the till.
A school wants to monitor the number of hours spent by a class of 30 students on the
Internet.
Using pseudocode or otherwise, write an algorithm which will;
• for each student, record the times logged on and logged off
• calculate the length of time each student spends online
• calculate and output the average length of time per day spent by each student on the
Internet.
Using pseudocode, or otherwise, write an algorithm that will input the hourly
temperatures for one day in Centigrade and print out in Fahrenheit
• the maximum temperature
• the minimum temperature
• the average temperature
for that day.
Using pseudocode or otherwise, write an algorithm that will input 25 marks and output the
number of DISTINCTION, MERIT, PASS or FAIL grades.
A mark greater than 69 will get a DISTINCTION, a mark between 69 and 60 (inclusive) will
get a MERIT and a mark between 59 and 50 (inclusive) will get a PASS.