[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference terri::cars_uk

Title:Cars in the UK
Notice:Please read new conference charter 1.70
Moderator:COMICS::SHELLEYELD
Created:Sun Mar 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2584
Total number of notes:63384

1224.0. "BASIC program for lease-car costs" by SAC::DELANY_S () Thu Sep 13 1990 13:52

    
    OK, OK, OK!!!
    
    I've had such an amazing response to my note (see the Golf GTi note a
    few back) re a BASIC program to calculate annual lease-car costs (well,
    at least five people mailed me!), that I thought I'd post it here for
    anyone's use. It also seemed sensible to put the program in one place
    to be copied as required, rather than clog up mail with x copies of the
    same thing...
    
    I'll post the program in the reply to this note, so you can extract it
    in its entirety. Here are a few words of explanation/clarification.
    
    I'll state up front that I don't pretend that this basic BASIC program
    is in the vanguard of programming skills (!), but it works (to my
    knowledge), and that's the main thing. There is no error handling
    though. When you run the program, it asks you information, which you
    enter at the prompts. A couple of things to look out for are: the
    business mileage rate should be entered in pounds, e.g. 8p/mile should
    be entered as 0.08; the current tax liability for a 2-litre (or under)
    car is �2200/year.
    
    (1) You need VAX BASIC on your system, but you can obviously use the
    program in any BASIC environment, with one or two small modifications
    to the program.
    
    (2) Extract the program to a filename on your system, giving it a name
    like LEASE_CAR.BAS, then type BASIC at the $ prompt.
    
    (3) When you get the "Ready" message, type:
    
       RUN LEASE_CAR (or whatever you called it).
    
    (4) Enter the information as requested, being careful not to press
    Return twice at one prompt (thus skipping a field): if this happens,
    you'll have to press CTRL/Z and start again! (As I said, there is no
    error handling!).
    
    (5) To leave the program, type CTRL/Z twice: once to break out of the
    program, and once to leave BASIC.
    
    
    Hope it works for you all. Let me know about any mods you have to
    improve it, or anything else you wish to say about it.
    
    
    Cheers,
    Stephen
T.RTitleUserPersonal
Name
DateLines
1224.2Strip off the notes info first....SAC::DELANY_SThu Sep 13 1990 13:554
    Sorry, forgot to mention that when you extract the program, you'll have
    to strip off the notes information from the top.
    
    S
1224.3Tints and hips!UKCSSE::RDAVIESLive long and prosperThu Sep 13 1990 14:453
    Or save/noheader thingy.wotsit
    
    Richard
1224.4COMICS::WEGGSome hard boiled eggs & some nutsThu Sep 13 1990 15:328
       or better:

       Notes> extract/nohead lease.bas
       $ basic lease
       $ link lease
       $ run lease

       Ian.
1224.5Whoops...SAC::DELANY_SThu Sep 13 1990 17:5113
    Grovel grovel grovel.....
    
    Sorry, a little "bugette" crept into V1.0 of the program, if you
    happened to have a quote that was less than any supplement you might
    receive (I hadn't tested this properly, as I don't get a supplement!):
    the next reply contains V2.0 of the program that hopefully now works
    properly (with V1.0, I was just making sure of getting a product to
    market, then testing it fully on the customers :-) )
    
    
    Rgds,
    S
                                                        
1224.6The CORRECT programSAC::DELANY_SThu Sep 13 1990 17:5225
10 REM Prog. to calc. annual cost of any lease car, incl. fuel and lease cost
20 INPUT "What is your annual business mileage",B
30 INPUT "What is your annual private mileage",P
40 INPUT "What is the current fuel price per gallon",F
50 INPUT "What is the current business mileage rate",R
60 INPUT "What is the annual quote for your lease car",Q
62 INPUT "What car supplement do you get",S
65 INPUT "What type of car is this",n$
68 INPUT "Enter your tax liability for your car's cc",T
70 INPUT "Enter the lowest anticipated mpg for your car",L
80 INPUT "Enter the highest anticipated mpg for your car",H
82 PRINT
83 PRINT
85 PRINT "TABLE OF ANNUAL COST FOR THE ";n$;", FOR A GIVEN RANGE OF MPG"
87 PRINT
90 PRINT "Mpg","Total Annual Car/Fuel Cost"
100 PRINT
110 FOR C = L TO H STEP 1
115 IF Q>S THEN PRINT C,((Q-S)*0.75)+(T*0.25)+(((P+B)/C)*F)-(B*R) ELSE PRINT C,(T*0.25)-((S-Q)*0.75)+(((P+B)/C)*F)-(B*R)
140 NEXT C
145 PRINT
146 PRINT
147 PRINT "THE PROGRAM IS NOW RUNNING AGAIN. PLEASE TYPE CTRL/Z TO EXIT"
150 GOTO 20
    
1224.7VAX Basic version...easier to understand :-)OVAL::ALFORDJIce a specialityFri Sep 14 1990 15:5674
---------------------------------- cut here -----------------------------------
program lease_cost

	! Prog. to calc. annual cost of any lease car, incl. fuel and 
	! lease cost

	declare  word	exit_prog &
		,gfloat	buis_miles &
		,	priv_miles &
		,	quote &
		,	suppl &
		,	cc &
		,	low_mpg &
		,	high_mpg &
		,	mile_rate &
		, 	fuel &
		,string car_type

	Exit_prog = 0

ask_again:

	When Error In
	  Print "Please type CTRL/Z to exit"
	  Print
	  Input "What is your annual business mileage", buis_miles
	  Input "What is your annual private mileage", priv_miles
	  Input "What is the current fuel price per gallon", fuel
	  Input "What is the current business mileage rate", mile_rate
	  Input "What is the annual quote for your lease car", quote
	  Input "What car supplement do you get", suppl
	  Input "What type of car is this", car_type
	  Input "Enter your tax liability for your car's cc", cc
	  Input "Enter the lowest anticipated mpg for your car", low_mpg
	  Input "Enter the highest anticipated mpg for your car", high_mpg
	Use
	  Exit_prog = -1
	End When

	goto finish_up  if Exit_prog

	Print for x = 1 to 2

	Print "Table of annual cost for the ";car_type;", for a given range of MPG"

	Print
	Print "Mpg","Total Annual Car/Fuel Cost"
	Print

	FOR C = low_mpg TO high_mpg
	  If quote>suppl 
	    Then 
		Print C &
			,((quote-suppl)*0.75) &
			+(cc*0.25) &
			+(((priv_miles+buis_miles)/C)*fuel) &
			-(buis_miles*mile_rate) 
	    Else 
		Print C &
			,(cc*0.25)-((suppl-quote)*0.75) &
			+(((priv_miles+buis_miles)/C)*fuel) &
			-(buis_miles*mile_rate)
	  End If
	Next C

	Print for x = 1 to 2

GOTO ask_again

finish_up:


	end program 0
1224.8Slight rathole...CURRNT::RUSSELLMiddle-aged Mutant Hero Turtle (UK option)Mon Sep 17 1990 14:048
    re.7;
    
    Well, Jane, I agree that it's easier to understand, but I still
    can't come to grips with programs that don't have line numbers on
    them!
    
    Peter.
    
1224.9more rathole !OVAL::ALFORDJIce a specialityTue Sep 18 1990 14:2910
    
>    Well, Jane, I agree that it's easier to understand, but I still
>    can't come to grips with programs that don't have line numbers on
>    them!
    
That's about when you stopped being a *real* programmer and moved into the 
Management levels wasn't it ?

:-)
1224.10Rathole closure.CURRNT::RUSSELLMiddle-aged Mutant Hero Turtle (UK option)Tue Sep 18 1990 16:2113
    
	re.9;
        
>That's about when you stopped being a *real* programmer and moved into the 
>Management levels wasn't it ?

    Jane, I resent that suggestion - I never moved into Management;
    I'm a consultant....
    
    Peter.
    
    P.S. but you are right; I don't do real programming any more!
    
1224.11I did say "Management Levels"...OVAL::ALFORDJIce a specialityWed Sep 19 1990 10:313

:-)