Ross Drummond


Links
Home Page
 
My recomended Linux applications
 
Christchurch Linux user group mailing list archive
 
BMW Marine B130 parts
Recipe
Scottish black bun
carpymnt.sh
Script - text highlighted
 
Script - plain text
 
Script - terminal view

carpymnt.sh

I have created a bash script to calculate the details for a hire purchase contract.

The typical user of this script would be a car salesperson filling out vehicle loan documentation. This script does not comply with New Zealand legislation, The Credit Contracts and Consumer Finance Act 2003.

Bash is a shell available on computers using the linux/unix/apple OSX operating systems. You may use this script on a computer with the Windows operating system using Cygwyn.

To run this script the following programs are required on your computer;

  • bc, a floating point maths program. Bash cannot do floating point calculations.
  • perl, a scripting language required by showtable.
  • showtable, a perl module to display output in a neat text based table.
  • date, to calculate a future date.

To do;

  • Accuracy test
  • Stress test
  • Error handling

Change log;

Sunday 22 February 2009
Added Interest Charged output.
Monday 30 April 2007
Added cost of credit and balance payable outputs.
Saturday 21st October 2006
Changed DateUnits loop to handle non standard payment intervals as an exception & not an error.
Corrected a logical error in calculating last payment date.
Monday 13th March 2006
Added isdigit() fuction to check input.
Added printf %i to output to show commas between thousands.
Changed for loop to run completely within bc. This has resulted in a worthwhile speed increase.
Friday 3rd December 2004
Added initialisation check for availiblity of dc and showtable.
Changed to accept both upper case and lower case input in yes/no questions
Sunday 21st November 2004
First publication of this script.

Phone +64 3 3086190
Mobile +64 21 1438599