From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_REPLYTO,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ba9a717d172afa4f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-08-31 12:17:55 PST Path: supernews.google.com!sn-xit-02!sn-east!supernews.com!news.maxwell.syr.edu!newsfeed.cwix.com!news-in.mts.net!news2.mts.net.POSTED!not-for-mail Message-ID: <39AEB8A4.82E8F3D0@brandonsd.mb.ca> From: N J Chackowsky Reply-To: nick@arcticmail.com X-Mailer: Mozilla 4.7 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: School Assignment--Can this be simplified? References: <39AD5DBD.972C97CA@brandonsd.mb.ca> <39AE0E2A.C11F53F4@baesystems.com> <39AEAE34.4E9753C8@brandonsd.mb.ca> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 31 Aug 2000 19:19:55 GMT NNTP-Posting-Host: 206.45.76.120 X-Complaints-To: admin@mts.net X-Trace: news2.mts.net 967749595 206.45.76.120 (Thu, 31 Aug 2000 14:19:55 CDT) NNTP-Posting-Date: Thu, 31 Aug 2000 14:19:55 CDT Organization: MTS Internet Xref: supernews.google.com comp.lang.ada:445 Date: 2000-08-31T19:19:55+00:00 List-Id: And here's the revised version. Interesting that there is no pow() function defined in elementary_functions at all. Where should I look for standard numerical constants such as e, pi, etc.? NJC. ----------------------------------------------------------------------- --| Calculates and displays the relative humidity based on --| the temperature and dew point. --| --| Author: N J Chackowsky, Brandon School Division No. 40 --| Last modified: 2000 08 31 ----------------------------------------------------------------------- with ada.text_io; with ada.integer_text_io; with ada.float_text_io; with ada.numerics.elementary_functions; procedure humidity is km : constant float := 5438.0; -- magic multiplier c2k : constant float := 273.15; -- Celcius -> Kelvin conversion term tempc, tempk : float; -- temperature in C and K dewc, dewk : float; -- dew point in C and K rh : float; -- relative humidity begin -- humidity -- Get the temperature and dew point ada.text_io.put(item => "What is the temperature in degrees Celcius? "); ada.float_text_io.get(item => tempc); ada.text_io.put(item => "What is the dew point in degrees Celcius? "); ada.float_text_io.get(item => dewc); -- Convert from C to K tempk := tempc + c2k; --probably revise this with a function call dewk := dewc + c2k; --in the next lesson. rh := ada.numerics.elementary_functions. exp(km * (1.0/tempk - 1.0/dewk)) * 100.0; -- Display results ada.text_io.put(item => "The relative humidity is "); ada.float_text_io.put(item => rh, fore => 1, aft => 1, exp => 0); ada.text_io.put(item => "%"); end humidity;