From: Andrew <eagletalon@chartermi.net>
Subject: interest computing problem
Date: Tue, 16 Sep 2003 10:27:04 -0500
Date: 2003-09-16T10:27:04-05:00 [thread overview]
Message-ID: <vmeb0k2buli9cf@corp.supernews.com> (raw)
ok I've run into a snag .. and i'm hoping that a programmer can help me
out.
here is a copy of my program (written in Ada)
====
-- computes Interest on money invested
with TEXT_IO;
use TEXT_IO;
procedure Interest is
Initialamt : Float;
Interest : Float;
TimeNWeeks : Integer;
DRate : Float;
Days : Integer;
Balance : Float;
package NUMBER_IO is new INTEGER_IO(INTEGER);
use NUMBER_IO;
package Float1_IO is new Float_IO(FLOAT);
use Float1_IO;
begin
New_Line;
Put ("How much money do you have-Please add cents? example 365.22 ");
Get (Initialamt);
Put ("What is the interest you will receive? ");
Get (Interest);
Put ("How long will it be invested in weeks? ");
Get (TimeNWeeks);
New_Line;
Days:=TimeNWeeks * 7;
DRate:=(Interest/100.0)/365.0;
Balance:=Initialamt * (1.0+DRate)**Days;
New_Line;
Put ("Your ending balance will be ");
Put (Balance);
New_Line;
end Interest;
========================================
now here is the output from when I try to run the program
==================
How much money do you have-Please add cents? .02
What is the interest you will receive? 25
How long will it be invested in weeks? 4
Your ending balance will be 2.03872E-02
[andrew@stc program]$ ./interest
How much money do you have-Please add cents? .02
What is the interest you will receive? .25
How long will it be invested in weeks? 4
Your ending balance will be 2.00038E-02
============
but I'm hoping that this is just a simple case of I .. well *L* I'm
hoping this is a simple error that I'm overlooking..
sub-note : this program is directly copied from a printout of a program
that I wrote in college (and it worked on the colleges computers).
By the way I'm writing this on a Red Hat Linux 9.0 computer (I don't
think that would matter but ..)
next reply other threads:[~2003-09-16 15:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-16 15:27 Andrew [this message]
2003-09-16 15:54 ` interest computing problem Ludovic Brenta
2003-09-16 17:21 ` tmoran
2003-09-17 4:26 ` Andrew
2003-09-16 21:52 ` Robert I. Eachus
2003-09-17 3:48 ` Andrew
2003-09-17 4:28 ` Andrew
2003-09-17 5:18 ` tmoran
2003-09-17 7:47 ` Andrew
2003-09-17 16:05 ` Andrew
2003-09-17 16:32 ` Martin Dowie
2003-09-17 16:36 ` Stupid! -was- " Andrew
2003-09-17 17:00 ` Stephane Richard
2003-09-17 17:15 ` Andrew
2003-09-19 4:07 ` Leon Winslow
2003-09-21 22:55 ` Andrew
-- strict thread matches above, loose matches on Subject: below --
2003-09-22 0:44 Robert I. Eachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox