ICT 110: Introduction to Programming
Assignment 1
Instructions
1. Write the source code for the three questions
2. Include details (i.e name, student number and programme of study) in each source file
as comments
3. Create one folder ( use your student number as folder name) and place the three
source files ONLY (i.e .cpp) in this folder
4. Logon Moodle and Submit the zipped folder in (3) for grading
[Link]
5. Send queries to hphiri@[Link]
6. Due Date: 7th June 2019
Question One
A farmer wishes to know the total cost and the amount of fertilizer required for his rectangular
field of crops. The amount of fertilizer is determined by first calculating the area of a field and
multiplying that by the rate of fertilizer application per square meter. Given that the rate of
application is 0.05kg per square meter and cost per kilogram of fertilizer is 10.50 kwacha per
Kg.
Write a program that accepts the length and width of a given field from the farmer. The program
then calculates and prints
The area of the field
Amount of Fertilizer in Kilograms required
Total cost of the fertilizer in Kwacha
1
Question Two
Domestic post-paid electricity tariffs are calculated as follows
Post paid tariff Energy charge /kWh
0-200 kWh K0.15
Above 200kWh K0.77
Fixed charge of K18.23
Additional charges include:
3% exercise duty
16% oVAT
Write a program that requests for the units consumed in kWh. The program should then
calculate and display the cost of the units, fixed charge, exercise duty, VAT and the Total Bill.
Question Three
The criteria to qualify to get a loan from Zed Bank is described as follows
First the applicant must have an account with the bank. If the applicant does not have an account
with the bank, they are given the message, “Please open an account before applying”. If the
applicant has an account, the period of time the applicant has been with the bank is checked. If
the period is less than 2 years, the applicant is given the message, “You have not banked with
us for more than 2 years”. If the period is 2 or more years, the credit record is then checked. If
the credit record is “bad”, the applicant is given the message, “Your credit history is bad”. If
the credit history is “good”, the applicant is asked for the amount they would like to borrow. If
the amount entered is above K250,000, the applicant is given the message, “The maximum
credit allowed is K250,000”.if the amount is between K500 to K250,000, the applicant is given
the message, “Congratulations you qualify to get this loan”. If the amount is below K500, the
applicant is given the message, “the amount is below the minimum limit”.
Write a program that uses nested if statements to determine whether a person qualifies for a
loan or not.