thing is, we all know this is homework.
so either work it out for yourself, or go ask for help from your tutor.
he gets paid to help you, you know.
he wont mind.
Its work but not home work as such. And i prefer peoples views on things here sometimes. A forum can be a place to ask for help and find a better way of doing something.
Thanks to the people who tried to help i've managed to get it working now and works quite nicely. But i'm having a problem getting a procedure to work. Basically the program works, the user enters some figures and then the program estimates some costs and then asks would you like the program to run again if yes then clear all data entered and program starts again in no then close.
Could someone take a look at the code below and see where i'm going wrong?
Thanks in advance
Program PaintEstimator;
Uses crt;
var
customer:string;
length:integer;
width:integer;
windows:integer;
doors:integer;
area:integer;
wall:integer;
woodwork:integer;
ceiling:integer;
doorsarea:integer;
windowsarea:integer;
paint1:real;
paint2:real;
paint3:real;
wallpaper:char;
wallpaper1:integer;
total:real;
total1:real;
total2:real;
total3:real;
subtotal:real;
VATtotal:real;
Grandtotal:real;
Close:Char;
Const
Emulsion = 3.50;
Gloss = 4.00;
Paperroll = 3.00;
VAT = 0.175;
Procedure Reset;
begin
paint1 := 0;
paint2 := 0;
paint3 := 0;
wallpaper1 := 0;
end;
Procedure Data;
begin
clrscr;
writeln ('Please enter the customers name:');
readln (customer);
writeln ('Please enter the length of the room in meters:');
readln (length);
writeln ('Please enter the width of the room in meters:');
readln (width);
writeln ('Please enter the number of doors:');
readln (doors);
writeln ('Please enter the number of windows:');
readln (windows);
writeln ('Would you like wallpaper? (Y/N):');
readln (wallpaper);
end;
Procedure DataProcessing;
begin
doorsarea := doors*2;
windowsarea := windows*2;
area := length*width+doorsarea+windowsarea;
paint1 := area div 8;
paint2 := area div 8;
paint3 := area div 6;
If wallpaper = 'Y' then
wallpaper1 := 4;
total := paint1 * emulsion;
total1 := paint2 * emulsion;
total2 := wallpaper1 * paperroll;
total3 := paint3 * gloss;
subtotal := total+total1+total2+total3;
VATtotal := subtotal*vat;
Grandtotal := subtotal+VATtotal;
end;
Procedure Information;
begin
repeat
writeln('********** Joe Blakes Painting & Decorating Estimator V1.00 **********');
writeln('********** Estimation of Costs for ',customer);
writeln('');
writeln('Materials');
writeln('Ceiling: ', paint1:0:2,' litres @','œ',emulsion:0:2,' per litre ','œ',total:0:2);
writeln('Walls: ', paint2:0:2,' litres @','œ',emulsion:0:2,' per litre ','œ',total1:0:2);
writeln('Rolls of paper: ', wallpaper1,' rolls @','œ',paperroll:0:2,'per roll ','œ',total2:0:2);
writeln('Woodwork: ', paint3:0:2,' litres @','œ',gloss:0:2,' per litre ','œ',total3:0:2);
writeln('Sub Total ','œ',subtotal:0:2);
writeln('VAT 17.5% ','œ',VATtotal:0:2);
writeln('Grand Total ','œ',grandtotal:0:2);
writeln('');
writeln('Would you like to run the estimator again? (Y/N):');
readln(close);
until close ='n';
readln;
end;
begin
reset;
data;
dataprocessing;
information;
end.