Navbar

  Elite Fitness Bodybuilding, Anabolics, Diet, Life Extension, Wellness, Supplements, and Training Boards
  Chat & Conversation
  Turbo Pascal

Post New Topic  
profile | register | preferences | faq | search

Author Topic:   Turbo Pascal
barney

Pro Bodybuilder

Posts: 350
From:down under
Registered: Jun 2000

posted November 24, 2000 12:13 AM

Staff Use Only: IP: Logged


does anyone have any experience in this basic programming. I just have a basic qustion/programme i need to write but i missed the classes in myComputing course on this subject and need help. anyone????


Click Here to See the Profile for barney   Click Here to Email barney     Edit/Delete Message      Reply w/Quote
Warik

Amateur Bodybuilder

Posts: 249
From:Miami, FL
Registered: Sep 2000

posted November 24, 2000 12:41 AM

Staff Use Only: IP: Logged


I'll help ya out... what seems to be the problem? (reply quick or you'll have to wait till I wake up in the mornin'... heh)

-Warik


Click Here to See the Profile for Warik     Edit/Delete Message      Reply w/Quote
barney

Pro Bodybuilder

Posts: 350
From:down under
Registered: Jun 2000

posted November 24, 2000 06:48 AM

Staff Use Only: IP: Logged


ok all u pascal wizards, heres the question:

A caresalesman wants a programme to display the following:

REGISTRAION WHOLESALE PRICE SELL PRICE
---------------------------------------------
XYZ1546 $1000 $1400

that is how the display must look, the sale price is 40% of the wholesale.
You must use a count so that the programme will only do 5 cars.

can anyone help, much appreciated!!


Click Here to See the Profile for barney   Click Here to Email barney     Edit/Delete Message      Reply w/Quote
Warik

Amateur Bodybuilder

Posts: 249
From:Miami, FL
Registered: Sep 2000

posted November 24, 2000 11:13 AM

Staff Use Only: IP: Logged


Ok. I don't know Pascal, so I took a few minutes to learn it so I can help you out here... if I have some errors in my code, it's cause I've never written anything in Pascal.

Ok, so it has to display the Registration, Wholesale Price, and Sell Price. I assume that you have to input the Registration and the Wholesale Price.

First you need to declare variables to store all of those values. You need the registration, the wholesale price, and the sell price.


var registration : char;
var wholesalePrice : real;
(it's "real" and not "integer" to accomodate any decimal points for cents)
var sellPrice : real;

Then you must assign values to those variables through keyboard input.

First your "begin" statement...


begin

writeln('Please enter the registration number: ');
read(registration);
writeln;
writeln('Please enter the wholesale price of the vehicle: ');
read(wholesalePrice);

Now you must calculate the sell price of the car. You said that the sale price is only 40% of the wholesale price... you have the wholesale price in your example at $1000 and the sell price at $1400. That's 40% MORE than the wholesale price. I'll assume that's what you meant.

sellPrice := wholesalePrice * 1.40;

Now to display the output. I'll let you figure that one out yourself... it's the easiest part of the program. =)

Now, you said that the program must only do 5 cars, so you can use a FOR loop which starts before the first "writeln" statement and ends right after you display the output.

So here is pretty much how the entire program should look. Please refrain from just copying it and being done with it for you will learn nothing and never be a good programmer. Ok, now that I've said that, here it is.

var registration : char;
var wholesalePrice : real;
var sellPrice : real;
var counter : integer;

begin

for counter := 1 to 5 do
begin
writeln('Please enter the registration number: ');
read(registration);
writeln;
writeln('Please enter the wholesale price of the vehicle: ');
read(wholesalePrice);

sellPrice := wholesalePrice * 1.40;

***CODE TO OUTPUT GOES HERE***
end;

end.

I think that should do it. If you have any more trouble, let me know.

-Warik

[This message has been edited by Warik (edited November 24, 2000).]


Click Here to See the Profile for Warik     Edit/Delete Message      Reply w/Quote
barney

Pro Bodybuilder

Posts: 350
From:down under
Registered: Jun 2000

posted November 25, 2000 01:14 AM

Staff Use Only: IP: Logged


thanks warick, ill give it a go this week in class, are u telling me u just learnt that on the spot, well done bro.


Click Here to See the Profile for barney   Click Here to Email barney     Edit/Delete Message      Reply w/Quote
Warik

Amateur Bodybuilder

Posts: 249
From:Miami, FL
Registered: Sep 2000

posted November 25, 2000 01:22 AM

Staff Use Only: IP: Logged


No problem, you're welcome.

Just worry about thinking how to SOLVE the problem before you start thinking about how to WRITE the solution. That's the key to getting a program written. Anyone can type out lines of code, but it takes skill to have those lines of code perform a specific task as efficiently as possible.

-Warik


Click Here to See the Profile for Warik     Edit/Delete Message      Reply w/Quote
Latimer

Elite Bodybuilder

Posts: 1114
From:
Registered: May 2000

posted November 25, 2000 08:40 AM

Staff Use Only: IP: Logged


What language do you normally program in Warik?


Click Here to See the Profile for Latimer     Edit/Delete Message      Reply w/Quote
Warik

Amateur Bodybuilder

Posts: 249
From:Miami, FL
Registered: Sep 2000

posted November 25, 2000 10:17 AM

Staff Use Only: IP: Logged


Normally, I'm an underpaid PHP programmer interacting with a MySQL database. I also know Perl and Visual Basic (if you can call that a programming language), and I'm taking a C++ "class" at college. (Note the quotes... they move sooo slowly.)

How about you, Latimer? Are you a programmer as well?

-Warik


Click Here to See the Profile for Warik     Edit/Delete Message      Reply w/Quote
Latimer

Elite Bodybuilder

Posts: 1114
From:
Registered: May 2000

posted November 27, 2000 09:49 PM

Staff Use Only: IP: Logged


I'm not a programmer. I've screwed around a little with VB and Java and even some C++. I'm in the Cisco Academy right now and will have my CCNA in spring and i'm studying at home for MCSE, which I should have shortly after I get my CCNA. I was just curious to see what kind of language you normally coded in. I'd like to get into PHP sometime in the future. My friend and I are developing a web site right now that will rely heavily on databases. We're still deciding which route to go but I'm leaning towards PHP.


Click Here to See the Profile for Latimer     Edit/Delete Message      Reply w/Quote

All times are ET (US)

Post New Topic  
Hop to:

Contact Us | Back to Elite Fitness | Privacy Statement

Powered by Infopop www.infopop.com © 2000
Ultimate Bulletin Board 5.45c



HomeArticlesDiscussion BoardsFeatured SitesContact Us� ReportsSupplementsShopping