Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 19th, 2007, 7:26 PM   #1
AlexN
Newbie
 
Join Date: Nov 2007
Posts: 2
Rep Power: 0 AlexN is on a distinguished road
Pascal assignment help

Hey guys im new here...

i need to make a program that estimates the costs of the following:


Materials


Ceiling: xx.x litres @ x.xx per litre 99.99
walls: xx.x litres @ x.xx per litre 999.99
xx rolls of paper @ xx.xx per roll 999.99
woodwork: xx.x litres @ x.xx per litre 99.99


Sub Total 999.99

VAT @ 17.5% 99.99

Final total 999.99


Request the inputs and use them to produce the estimate in the required format(see above).
Assume the following:


- each door occupies 2 square metres and requires 1 litre of paint
- each window occupies 2 square metres but requires only 0.5 litres of paint
- emulsion paint gives a coverage of 8 squre metres per litre
- emulsion paint costs £3.50 per litre
- Gloss paint gives a coverage of 6 square metres per litre
- gloss paint gives £4.00 per litre
- Wall paper rolls are 1m by 10m
- note: walls are either painted or wallpapered, not both
gloss paint is used on woodwork, emulsion everywhere else
paint is covered in 1 coat

repeat process untill there are no more estimates


the main thing im having trouble with is the structure of it.... how would you guys structure said assignment this is what i have so far:

program Estimator;

var

height, width, length : real;
Ceiling, walls : real;
Paint1, Paint2 : real;
Cust: integer;
Litres1 : integer;
Litres2 : integer;
paperolls : integer;
doors : integer;
windows : integer;
Vat : real;
Total : real;


begin (* Main *)
writeln ('Joe Blakes Painting & Decorating Tel: 01522 522522');
readln;
writeln <'Enter the Customers name:'>;
readln<Cust>;
writeln <'Please Enter the dimensions of the room'>;
readln;
writeln<'Enter the height in metres:'>;
readln<height>;
write<'Enter the width in metres:'>;
readln<width>;
write<'Enter the length in metres:'>;
readln<length>;
Ceiling:=width*length;
paint1:=ceiling/8;
walls:=<length + width>*2*height;
paint2:= walls/6;
writeln<'ceiling needs',paint1:0:1,'litres');
write<'walls need',paint2:0:1,'litres');
end;

begin

litres1 := 03.50
litres2 := 04.00

end.

Last edited by DaWei; Nov 19th, 2007 at 8:32 PM. Reason: Added code tags. Read the rules.
AlexN is offline   Reply With Quote
Old Nov 19th, 2007, 8:35 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Pascal assignment help

I'd begin by learning where the tab key is.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Nov 19th, 2007, 9:28 PM   #3
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 143
Rep Power: 4 Arla is on a distinguished road
Re: Pascal assignment help

1st,

Revise your problem to figure out all the input variables, you're missing door/window input, also how do you determine wall-paper vs paint (is that a yes/no question? Not sure, depends on the problem).

2nd, once revised all you really need to do is figure out the total area of each location (walls and ceiling, woodwork and wall-paper) and then just do the division, remember of course that each fraction of a size will need a full liter or roll of paper (eg if you wall is only 4 square meters, you will need a liter of either gloss or matt paint to cover it, even though it's smaller than the area).
Arla is offline   Reply With Quote
Old Nov 20th, 2007, 8:08 AM   #4
AlexN
Newbie
 
Join Date: Nov 2007
Posts: 2
Rep Power: 0 AlexN is on a distinguished road
Re: Pascal assignment help

thanks for the help guys, was having a meltdown last night and as you said if i broke it down at thought about each point separatly it would make things a whole lot easier..

here it is anywayz:
(* Author:    Alex N
   Date:      12 November 2007
   Description:
      Painting & Decorating cost estimator
*)



program  JoeBlakesEstimator;    {program name}
uses crt;

var
   customername : string; {List of variablez}
   Joe: string;
   length : integer;
   width : integer;
   windows : integer;
   doors : integer;
   squareroom : integer;
   ceilingcost : integer;
   wallcost : integer;
   woodworkcost : integer;
   doors2 : integer;
   windows2 : integer;
   litres1 : real;
   litres2 : real;
   litres3 : real;
   rollp : char;
   rollp2 : integer;
   total : real;
   total1 : real;
   total2 : real;
   total3 : real;
   subtotal : real;
   finaltotal : real;
   vattotal : real;
   close : char;

const
     emulsion = 3.50;           {list of constants, values that never change}
     gloss = 4.00;
     wallpaper = 3.00;
     VAT = 0.175;

 procedure reset;

  begin
     litres1 := 0;           {resets some values}
     litres2 := 0;
     litres3 := 0;
     rollp2  := 0;;
  end;

 procedure inputs;              {this is where the specified information is input}

  begin
     clrscr;
     writeln('Enter customer name');
     readln(customername);
     writeln('Enter the Length (metres)');
     readln(length);
     writeln('Enter the Width (metres)');
     readln(width);
     writeln('How many doors?');
     readln(doors);
     writeln('How many windows?');
     readln(windows);
     writeln('rolls of paper? (Y/N)');
     readln(rollp);
  end;

 procedure calculations;         {the calculations for the information}
  begin
     doors2 := doors * 2;
     windows2 := windows * 2;
     squareroom := length * width + doors2 + windows2;
     litres1 := squareroom div 8;
     litres2 := squareroom div 8;
     litres3 := squareroom div 6;
     If rollp = 'Y' then
     rollp2 := 4;
     total := litres1 * emulsion;
     total1 := litres2 * emulsion;
     total2 := rollp2 * wallpaper;
     total3 := litres3 * gloss;
     subtotal := total + total1 + total2 + total3;
     vattotal := subtotal * vat;
     finaltotal := subtotal + vattotal;
  end;

 procedure display;             {This gives you the end product after the calculations have been made}
  begin
     repeat
     writeln(' Joe Blake Painting & decorating ');
     writeln(' Estimate of costs for ',customername);
     writeln('');
     writeln('MATERIALS');                                                    {sets number of decimal places}
     writeln('Ceiling:           ', litres1:0:2,' litres           @',' £',emulsion:0:2,' per litre         ','£',total:0:2);
     writeln('Walls:             ', litres2:0:2,' litres           @',' £',emulsion:0:2,' per litre         ','£',total1:0:2);
     writeln('Rolls for Walls:   ',rollp2,' rolls of paper       @',' £',wallpaper:0:2,' per roll          ','£',total2:0:2);
     writeln('Woodwork:          ',litres3: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('FINAL TOTAL                ','£',finaltotal:0:2);
     writeln('Would you like to run again? (Y/N)');
     readln(close);                                  {asks if the program would like to be re run}
     until close = 'n';
     readln;
 end;

 begin
     reset;
     inputs;
     calculations;
     display;
end.

Last edited by DaWei; Nov 20th, 2007 at 8:26 AM. Reason: Added code tags; please grow up and do this yourself.
AlexN is offline   Reply With Quote
Old Nov 20th, 2007, 10:30 AM   #5
Arla
Hobbyist Programmer
 
Join Date: Mar 2005
Posts: 143
Rep Power: 4 Arla is on a distinguished road
Re: Pascal assignment help

Your numbers are now going to be way off, your adding doors and windows on top of length * width * 2 (remember, doors and windows will be included in the length * Width)

Also you're calculating woodwork as the same as everything else, again you have no question for how much woodwork, so you have no way to tell how much woodwork you're going to have to cover at this point.
Arla is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Little bit of pascal help irish Other Programming Languages 9 Oct 11th, 2006 8:53 AM
Pascal? Indigno Other Programming Languages 14 Sep 24th, 2006 2:38 AM
Pascal or C OS bigguy Coder's Corner Lounge 15 Feb 27th, 2006 5:20 PM
Images in TURBO PASCAL S_A_L_M_A_N Other Programming Languages 4 Dec 20th, 2005 9:38 AM
Need help badly: Pascal conversion to C joan400 C 0 Apr 12th, 2005 9:48 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:15 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC