Professional Documents
Culture Documents
Week 3: 15/7/2016
1. Write a program to compute and print water bill given an unpaid balance and
previous and current meter reading. Bill includes a demand charge of rs
35.00, a consumption charge of rs 1.10 per every 1000 liters used. Calculate
from meter reading taken recently and at the end of previous month. If the
costumers unpaid balance is greater than zero then rs 10.00 a late charges
is accessed as well.
2. Write a program implementing nested if statements if statement for the
following flow chart.
false
ph>7
true
ph=7
false
ph<12
true
false
neutral
ph>2
false
true
true
alkaline
very alkaline
acidic
3. Write a program that will calculate and print bills for city Power Company. The
rates vary depending on whether the use in residential, commercial or industrial.
A code R, means Residential use. Any other code should be treated as errors
other than C for commercial use and I for industrial use. The rates are computed
as follows:
a. R:
b. C:
rs 60.00 for first 1000 kwh and rs 0.045 for each additional kwh
c. I:
Let H = High, VH = Very High, S = Slow, Q = Quite Slow indicate the associated
fuzzy sets as follows
For X = { 30, 40, 50, 60, 70, 80, 90, 100 }, the set of temperatures
Y = { 10, 20, 30, 40, 50, 60 }, the set of rotations per minute
H = { ( 70, 1 ) ( 80, 1 ) ( 90, 0.3 ) }
VH = { ( 90, 0.9 ) ( 100, 1 ) }
S = { ( 10, 1 ) ( 20, 0.8 ) }
QS = { ( 30, 0.8 ) ( 40, 1 ) ( 50, 0.6 ) }
Apply the Fuzzy Modus Ponens rule to deduce rotation is quite slow
i. If the Temparature is high, then rotation is slow.
ii. The Temparature is very high.