Xref: utzoo unix-pc.general:7283 comp.sys.att:11520 comp.sources.bugs:2795 Path: utzoo!utgpu!watserv1!watmath!uunet!samsung!usc!zaphod!wuarchive!udel!rochester!kodak!crassi From: crassi@kodak.kodak.com (Charlie Crassi) Newsgroups: unix-pc.general,comp.sys.att,comp.sources.bugs Subject: Re:Re:loan.c bug Message-ID: <1991Jan15.155525.27664@kodak.kodak.com> Date: 15 Jan 91 15:55:25 GMT Sender: crassi@kodak.kodak.com (Charlie Crassi) Organization: Eastman Kodak Co, Rochester, NY Lines: 51 RE:bug in loan.c In looking over the code, I believe I have discovered the problem with the perceived bug. If on the command line you enter the month as a alpha string, March, the program prints a schedule from january of the specified year. However, in looking at the code, it expects the month to be a number between 1 and 12. If you enter 3 instead of March, the program runs and prints the schedule correctly. The followinf 2 lines of text illustrate the command line arguments in both the correct and incorrect formats and the results. RIGHT WAY: loan 19200 6 30 5 1967 ========================================================================== Loan amount: $19200.00 APR: 6.000% Term: 30 years starting May 67 360 monthly payments of $115.11 Pay't Date Principal Interest Balance Interest Interest no. due Payment Payment of loan (total) (YTD) 1 May 67 19.11 96.00 19180.89 96.00 96.00 2 Jun 67 19.21 95.90 19161.68 191.90 191.90 3 Jul 67 19.30 95.81 19142.38 287.71 287.71 4 Aug 67 19.40 95.71 19122.98 383.42 383.42 5 Sep 67 19.50 95.61 19103.48 479.03 479.03 ============================================================================ WRONG WAY: loan 19200 6 30 may 1967 ============================================================================ Loan amount: $19200.00 APR: 6.000% Term: 30 years starting Jan 67 360 monthly payments of $115.11 Pay't Date Principal Interest Balance Interest Interest no. due Payment Payment of loan (total) (YTD) 1 Jan 67 19.11 96.00 19180.89 96.00 96.00 2 Feb 67 19.21 95.90 19161.68 191.90 191.90 3 Mar 67 19.30 95.81 19142.38 287.71 287.71 4 Apr 67 19.40 95.71 19122.98 383.42 383.42 5 May 67 19.50 95.61 19103.48 479.03 479.03 ============================================================================= I modified the usage line in the code as a reminder. -- charlie