annsampson 0 Newbie Poster

high my program is not running properly the run screen never stays on error message "error linking"

Program Auto_Company;
Var
carmodel:ARRAY[1..10]OF STRING;
category:ARRAY[1..10]OF string;
noofcars:integer;
rentalfee:real;
totalrentalcost:real;
carentry:string;
appcar:integer;
A:char;
B:char;
C:char;
Chevrolet:string;
HondaCivic:string;
NissanPrimera:string;
NissanB14:string;
Subaru:string;
MitsubishiLancer:string;
Mazda:string;
Mercedes:string;
BMW:string;
Peugeot:string;
R:INTEGER;


Procedure INTRODUCTION;
BEGIN
Writeln('Welcome to program Auto_Company');
Writeln('This program allows you to enter a car model and it will calculate');
END;

Procedure PopulateArray;


Begin
carmodel[1]:= Chevrolet;
carmodel[2]:= HondaCivic;
carmodel[3]:= NissanPrimera;
carmodel[4]:= NissanB14;
carmodel[5]:= Subaru;
carmodel[6]:= MitsubishiLancer;
carmodel[7]:= Mazda;
carmodel[8]:= Mercedes;
carmodel[9]:= BMW;
carmodel[10]:= Peugeot;

END;


Procedure INITIALISE;
BEGIN
carentry:=' ';
noofcars:=0;
rentalfee:=0;
A:=' ';
B:=' ';
C:=' ';
totalrentalcost:=0.00;
appcar:=0;
r:=0;
Chevrolet:= a;
HondaCivic:=' ';
NissanPrimera:=' ';
NissanB14:=' ';
Subaru:=' ';
MitsubishiLancer:=' ';
Mazda:= Mazda;
Mercedes:=' ';
BMW:= BMW;
Peugeot:=' ';
END;


Procedure determinerentfee;
Var
F:INTEGER;
Begin
FOR F:= 1 to 10 DO
BEGIN
IF category[F]= A then
rentalfee := 1000
else if category[F]= B then
rentalfee := 600
else if carentry[F] = C then
rentalfee := 400
END;
END;

procedure userinput;
begin

writeln('enter car model or type end to exit');
read (carentry);
noofcars:=1;
while carentry <> 'end' do
noofcars:=noofcars+1;
writeln('goodbye');
end;

FUNCTION SEARCH :integer;
VAR
j:INTEGER;
key:string;
BEGIN
J:= 1;
key:= carentry;
while j <= 10 do
begin
if key = carmodel[j]then break;
j:=j+1;
end;
if j <= 10 then search := j
else
search:= -1;

end;

procedure calculate;
begin

for r :=1 to 10 do
while carentry = carmodel[r]do
appcar:= appcar +1;
determinerentfee;
totalrentalcost:=totalrentalcost+rentalfee;
if carentry <> carmodel[r] then
writeln ('model not found');
end;


Procedure OUTPUT;


BEGIN
writeln('the rental fee is', rentalfee);
Writeln('Number of approved cars are',appcar);
Writeln('Total rental cost is',totalrentalcost);
writeln('total number of cars entered is:',noofcars);
END;

BEGIN {MAIN PROGRAM}
INTRODUCTION;

populatearray;
INITIALISE;
while enteredcar <> 'end' do
userinput;
search;
calculate;
output;
writeln('enter the next carmodel');
END.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.