99shassan
06-15-2005, 09:25 PM
Hi,
I've made this program for my school project. My teacher won't be in for a few days so I can't ask her...
I've made a program and here is the code:
{Creator - NAME HIDDEN - 7.03.05}
Program Carpet_Calculator(Input,Output);
USES Wincrt;
CONST
Vat_Rate = 0.175; {This is the vat that has to be added to the total price}
Adjustment = 0.1;
VAR
length, Width, Area, TotalCost, Discount, TotalCost_Inc_Discount, Vat,
Total_Cost_plus_VAT, PricePerMetre, phonenumber : Real;
fitting : char;
Begin
Writeln('--------------------------------------------------< by: NAME HIDDEN >---');
Writeln(' Carpet Warehouse ');
Writeln('------------------------------------------------------------------------');
Write('Enter the required length (M)?: '); {Enter the length of the carpet}
Readln(length);
Write('Enter the required Width? (M)?: '); {Enter the Width of the carpet}
Readln(Width);
Length:= length + Adjustment; {Adjustment is 0.1 to take into
account sloping walls}
Width:= Width + Adjustment;
Write('Enter the Price Per Metre?:');
Readln(PricePerMetre);
Area:= Length * Width;
Writeln('The area is :',Area:5:2);
TotalCost:= Area * PricePerMetre;
writeln('Cost of Carpet is: £',totalcost:5:2);
{Discount}
IF PricePerMetre > 15 THEN
begin
Discount:= (TotalCost * (10/100));
Writeln('Discount Amount is £',Discount:5:2);
TotalCost_Inc_Discount:= TotalCost - Discount;
totalCost:= TotalCost_Inc_Discount;
Writeln('Total Cost Including Discount is £',TotalCost:5:2);
end;
{vat}
VAT:= TotalCost * VAT_Rate;
Writeln('Vat Amount is: £',Vat:5:2);
Total_Cost_plus_VAT:= TotalCost + VAT;
Writeln('Total Cost Including VAT: £', Total_Cost_plus_VAT:5:2);
writeln;
write('Would you like your carpet fitted? (Y or N): ');
readln(fitting);
If fitting = 'Y' then
begin
totalCost:=Total_Cost_plus_VAT +30;
writeln('An Extra £30 will be added: £ ',totalcost:5:2);
end
else
If fitting = 'y' then
begin
totalCost:=Total_Cost_plus_VAT +30;
writeln('An Extra £30 will be added. The final price is: £',totalcost:5:2);
end
else
writeln('No Fitting required...');
writeln('Enter Customer Phone Number:');
readln(phonenumber);
end.
This is what i have to do:
1. The length, width and price per metre values must not accept zero.
2. the range of price per metre values allowed, should not be zero and should not exceed £50.
3. Include some code in the program to allow the entry of the customer’s telephone number, ensure that the telephone number only contains numbers, no alphabetic or other characters allowed.
I've added the phone number option (at teh bottom of the code), but I have no idea how to make the program not accept 0 and for the price per metre not exceed £50
If someone can help, thanx thanx thanx!!!!
I've made this program for my school project. My teacher won't be in for a few days so I can't ask her...
I've made a program and here is the code:
{Creator - NAME HIDDEN - 7.03.05}
Program Carpet_Calculator(Input,Output);
USES Wincrt;
CONST
Vat_Rate = 0.175; {This is the vat that has to be added to the total price}
Adjustment = 0.1;
VAR
length, Width, Area, TotalCost, Discount, TotalCost_Inc_Discount, Vat,
Total_Cost_plus_VAT, PricePerMetre, phonenumber : Real;
fitting : char;
Begin
Writeln('--------------------------------------------------< by: NAME HIDDEN >---');
Writeln(' Carpet Warehouse ');
Writeln('------------------------------------------------------------------------');
Write('Enter the required length (M)?: '); {Enter the length of the carpet}
Readln(length);
Write('Enter the required Width? (M)?: '); {Enter the Width of the carpet}
Readln(Width);
Length:= length + Adjustment; {Adjustment is 0.1 to take into
account sloping walls}
Width:= Width + Adjustment;
Write('Enter the Price Per Metre?:');
Readln(PricePerMetre);
Area:= Length * Width;
Writeln('The area is :',Area:5:2);
TotalCost:= Area * PricePerMetre;
writeln('Cost of Carpet is: £',totalcost:5:2);
{Discount}
IF PricePerMetre > 15 THEN
begin
Discount:= (TotalCost * (10/100));
Writeln('Discount Amount is £',Discount:5:2);
TotalCost_Inc_Discount:= TotalCost - Discount;
totalCost:= TotalCost_Inc_Discount;
Writeln('Total Cost Including Discount is £',TotalCost:5:2);
end;
{vat}
VAT:= TotalCost * VAT_Rate;
Writeln('Vat Amount is: £',Vat:5:2);
Total_Cost_plus_VAT:= TotalCost + VAT;
Writeln('Total Cost Including VAT: £', Total_Cost_plus_VAT:5:2);
writeln;
write('Would you like your carpet fitted? (Y or N): ');
readln(fitting);
If fitting = 'Y' then
begin
totalCost:=Total_Cost_plus_VAT +30;
writeln('An Extra £30 will be added: £ ',totalcost:5:2);
end
else
If fitting = 'y' then
begin
totalCost:=Total_Cost_plus_VAT +30;
writeln('An Extra £30 will be added. The final price is: £',totalcost:5:2);
end
else
writeln('No Fitting required...');
writeln('Enter Customer Phone Number:');
readln(phonenumber);
end.
This is what i have to do:
1. The length, width and price per metre values must not accept zero.
2. the range of price per metre values allowed, should not be zero and should not exceed £50.
3. Include some code in the program to allow the entry of the customer’s telephone number, ensure that the telephone number only contains numbers, no alphabetic or other characters allowed.
I've added the phone number option (at teh bottom of the code), but I have no idea how to make the program not accept 0 and for the price per metre not exceed £50
If someone can help, thanx thanx thanx!!!!