0% found this document useful (0 votes)
227 views

Question On Algorithms

The document contains descriptions of several problems that can be solved using algorithms and pseudo code. It provides details to design algorithms to: 1) Prompt a user to enter two numbers and divide them, handling division by zero errors. 2) Read temperature data, convert to Fahrenheit, and calculate average weekly temperature. 3) Calculate annual deposits, interest, and totals over multiple years until an amount is exceeded. 4) Calculate member savings account interest and totals based on share amounts. 5) Calculate employee salaries and benefits based on experience, sales, and other factors.

Uploaded by

Douglas Simiyu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
227 views

Question On Algorithms

The document contains descriptions of several problems that can be solved using algorithms and pseudo code. It provides details to design algorithms to: 1) Prompt a user to enter two numbers and divide them, handling division by zero errors. 2) Read temperature data, convert to Fahrenheit, and calculate average weekly temperature. 3) Calculate annual deposits, interest, and totals over multiple years until an amount is exceeded. 4) Calculate member savings account interest and totals based on share amounts. 5) Calculate employee salaries and benefits based on experience, sales, and other factors.

Uploaded by

Douglas Simiyu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

With aid of a pseudo code and a flowchart, design an algorithm that would:

 Prompt the user to enter two numbers X and Y


 Divide X by Y. However, if the value of Y is 0, the program should display an error message
“Error: Division by zero”.

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.

Write an algorithm, using pseudocode or otherwise, which;


• inputs 50 numbers
• checks whether each number is in the range 1000 to 9999
• outputs how many of the input numbers were out of range
• outputs the percentage of input numbers which were out of range.

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.

You might also like