Thread View: news.software.misc
1 messages
1 total messages
Started by Andrew Taylor
Wed, 13 Mar 2002 03:48
(no subject)
Author: Andrew Taylor
Date: Wed, 13 Mar 2002 03:48
Date: Wed, 13 Mar 2002 03:48
138 lines
4221 bytes
4221 bytes
This is a multi-part message in MIME format.
--------------663D3FEEC547C0AF0DB98CFA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--------------663D3FEEC547C0AF0DB98CFA
Content-Type: text/plain; charset=us-ascii;
name="pool3.e"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="pool3.e"
-- 05-03-2001 Rectangular pool example with if-then-else
class POOL3
creation
make
feature
length, width, depth : REAL -- dimensions in metres
volume : REAL -- in cubic metres
chlorine_level : REAL -- parts per million (ppm) of Cl
low_limit : REAL is 1.0 -- acceptable chlorine low limit (ppm)
high_limit : REAL is 1.5 -- acceptable chlorine high limit (ppm)
add_amount : REAL -- grams of Cl to add
make is
do
length := 25.0
width := 10.0
depth := 1.5
volume := length * width * depth
-- get chlorine concentration
io.put_string("Type in chlorine reading (ppm) : ")
io.read_real
chlorine_level := io.last_real
-- Check chlorine level
if chlorine_level < low_limit then
-- calculate amount of chlorine to add
add_amount := volume * (high_limit - chlorine_level)
-- report amount to add
io.put_string("Add chlorine : ")
io.put_real_format(add_amount, 1)
io.put_string(" grams"); io.put_new_line
else
io.put_string("Chlorine level acceptable."); io.put_new_line
end -- if
end -- make
end -- class POOL3
--------------663D3FEEC547C0AF0DB98CFA
Content-Type: text/plain; charset=us-ascii;
name="pool2.e"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="pool2.e"
-- 07-03-2002 Pool program - version 2
class POOL2
creation
make
feature
-- declarations
length : REAL -- dimensions in metres
width : REAL
depth : REAL
volume : REAL
capacity : REAL
litres_per_m3 : REAL is 1000.0 -- a constant
-- creation procedure
make is
do
-- assignment statements
length := 25.0
width := 10.0
depth := 1.5
volume := length * width * depth
capacity := litres_per_m3 * volume
-- print results
io.put_string("Pool volume (m3): ")
io.put_real_format(volume, 0); io.put_new_line
io.put_string("Capacity (litres): ")
io.put_real_format(capacity, 0); io.put_new_line
end -- make
end -- class POOL2
--------------663D3FEEC547C0AF0DB98CFA
Content-Type: text/plain; charset=us-ascii;
name="pool1.e"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="pool1.e"
-- 05-03-2002 Rectangular pool example
class POOL1
creation
make
feature
-- declarations
length : REAL -- dimensions in metres
width : REAL
depth : REAL
volume : REAL
-- creation procedure
make is
do
-- assignment statements
length := 25.0
width := 10.0
depth := 1.5
volume := length * width * depth
-- print results
io.put_string("Pool volume : ")
io.put_real_format(volume, 1)
io.put_new_line
end -- make
end -- class POOL1
--------------663D3FEEC547C0AF0DB98CFA--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads