Article View: news.software.misc
Article #2885(no subject)
From: 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--
Technical Details
Message-ID:
<3C8ECBFD.775F7BB4@student.anu.edu.au>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.misc.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news1.optus.net.au!optus!clarion.carno.net.auShow Full Headers
Complete Article Headers
Message-ID: <3C8ECBFD.775F7BB4@student.anu.edu.au> Subject: (no subject) Date: Wed, 13 Mar 2002 14:48:13 +1100 From: Andrew Taylor <u3970302@student.anu.edu.au> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.misc.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news1.optus.net.au!optus!clarion.carno.net.au Organization: ANU Computer Science Student System X-Mailer: Mozilla 4.79 [en] (X11; U; SunOS 5.8 sun4u) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: news.software.misc Content-Type: multipart/mixed; boundary="------------663D3FEEC547C0AF0DB98CFA" NNTP-Posting-Host: 150.203.24.4 X-Original-NNTP-Posting-Host: 150.203.24.4 X-Trace: clarion.carno.net.au 1015990958 150.203.24.4 (13 Mar 2002 14:42:38 +1100) Lines: 137