Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 HELP!!!!! Need help with making a certain turing program
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
The Stuff




PostPosted: Sun Jan 11, 2004 9:46 pm   Post subject: HELP!!!!! Need help with making a certain turing program

I need to make a program where the user enters the milage (Litres/100km) and the size of his gas tank. there are 8 different places all over which the car can travel to. you select a place and the car goes there and burns up fuel. and i gotta display the gas consumption. all the distances must be different and the car refuels at each place. I gotta draw a car 2!!!!. plz i need help Crying or Very sad
I need some1 to help me with the selecting place thing Crying or Very sad
help with showing the car buring up fuel according to the milage Crying or Very sad
help with the displaying how much gas is left. Crying or Very sad
and the refueling the car at every destination. Crying or Very sad

PLZ someone help me. i don't know how to do this. i don't know how to write the code. I'm begging here. i can't do this and my mean teacher won't help me cuz she's so horrible and doesn't teach us. she just gives the assignments. I have a friend who said u guys helped him and saved his bacon. i was really hoping u guys could help me 2
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Sun Jan 11, 2004 9:52 pm   Post subject: (No subject)

Your asking someone to write the entire code for you....

I'll provide help but not going to do your schoolwork for you.

First, how much do you know about Turing?
McKenzie




PostPosted: Sun Jan 11, 2004 9:52 pm   Post subject: (No subject)

What do you have so far?
Cervantes




PostPosted: Sun Jan 11, 2004 9:55 pm   Post subject: (No subject)

my guess is nothing Razz
poly




PostPosted: Sun Jan 11, 2004 10:04 pm   Post subject: (No subject)

if youve been taught how to use a variable and a put, than you should easily be able to do it
Cervantes




PostPosted: Sun Jan 11, 2004 10:06 pm   Post subject: (No subject)

and drawbox and get Smile
The Stuff




PostPosted: Sun Jan 11, 2004 10:35 pm   Post subject: (No subject)

ya but i don't know how to decrease the gas over time. and refill it once it hits a certain spot or the spot where it is..
i got the car drawn. i got the spot. i donno how too decrease it and put the car moving so that it decreases only when the car moves and decrease it differently for every coordinate or destination. plz!!! help. just this 1 part give me the code for this part plz Crying or Very sad this is the most complex part!!!!!! some of the other parts i can do but i'll need a little help. but the part i just mensioned, i have no idea what 2 do
McKenzie




PostPosted: Sun Jan 11, 2004 10:37 pm   Post subject: (No subject)

Attach your code
Cervantes




PostPosted: Sun Jan 11, 2004 10:43 pm   Post subject: (No subject)

You'll need to have an if statement of if the car is moving and if it is decrease it by however much, if not don't decrease it. That whole thing will be in a loop. If the car is in a city (bunch of ways of doing that) then just reset the gas amount by doing gas := ##


well I explained that horribly. well, attach your codeas McKenzie says Razz
The Stuff




PostPosted: Mon Jan 12, 2004 6:19 pm   Post subject: (No subject)

here is the code i have so far

var x, y : int := 0
var key : string (1)
var reply : string (1)
var litres, milage : real
var winID1 : int
var pictureID : int
var pictureWidth, pictureHeight : int
var city : string
%
%===========================================================================%
%setscreen
%
winID1 := Window.Open ("position:0;0, graphics:639;399") %opening a window

%
%===========================================================================%
%Title
locate (1, 33) %changing the cursor coordinates
colour (40) %changng font colour
colourback (7) %changing font background colour
put "Gas Consumption" ..
colourback (0) %resetting font background colour
put ""
put ""

%Starting the program
colour (11) %changng font colour
colourback (7) %changing font background colour
put "press any key to continue" ..
colourback (0)
getch (reply) %pressing a key
cls %clear screen

%Introduction
locate (1, 33) %changing the cursor coordinates
colour (40) %changng font colour
colourback (7) %changing font background colour
put "Gas Consumption" ..
colourback (0) %resetting font background colour

%User input
locate (3, 1)
put "Hello, this is a program which will help you understand gas consumption in"
put "a car."
put ""
put "Milage is how much gas in litres is consumed per 100km to the nearest 10th"
put "Please enter the milage you car gets for highway driving: " ..
loop
get milage %getting milage litres
if milage > 30 or milage < 2 then
put "error, that isn't a reasonable milage for a car. try again."
else
exit
end if
end loop
put ""
put "Please enter the size of you gas tank in litres"
loop
get litres %getting total amount of litres
if litres > 200 or litres < 10 then
put "error, that isn't a reasonable litre amount for a car. try again."
else
exit
end if
end loop


pictureID := Pic.FileNew ("ontario annoying map of stuff.bmp")
pictureWidth := Pic.Width (pictureID)
pictureHeight := Pic.Height (pictureID)
Pic.Draw (pictureID, 350, 10, picMerge)
getch (key)
if key = chr (10) or key = chr (27) then
Pic.Free (pictureID)
end if

put "enter the place you wish to travel to starting from Toronto in lowercase"
get city:*

if city = "thunder bay" then

elsif city = "sudbury" then

elsif city = "windsor" then

elsif city = "kingston" then

elsif city = "london" then

elsif city = "hamilton" then

elsif city = "ottawa" then
-

end if

i need help with the if statements at the end. i don't know how to make the gas tank decrease as it travels from toronto to the other places. i was going to do coloured dots to show the path. but i really need help with the if statements at the end Crying or Very sad i don't know how to decrease the gas according to what the user enters and how to change the gas decrease between cities

from toronto to :

thunder bay :901 km
sudbury : 360 km
windsor: 330 km
kingston: 263 km
london: 220 km
hamilton: 83 km
ottawa :379 km


how do i do this part at the end with the gas conmsumption per 100 km in litres. i need to fix the last part and i donno how. plz help
The Stuff




PostPosted: Mon Jan 12, 2004 6:42 pm   Post subject: (No subject)

i have the places on certain parts on the map
McKenzie




PostPosted: Mon Jan 12, 2004 6:46 pm   Post subject: (No subject)

I don't mean to be picky, but use WinZip to Zip your bitmaps with your code then use the "Add an Attachment" button at the bottom
The Stuff




PostPosted: Mon Jan 12, 2004 6:46 pm   Post subject: (No subject)

the map is a bmp and i can't attach it
The Stuff




PostPosted: Mon Jan 12, 2004 9:13 pm   Post subject: (No subject)

the pic is from : http://www.pmrentals.com/french_site/images/ontario.gif

thats the map. plz can some1 help me?
Dan




PostPosted: Mon Jan 12, 2004 9:42 pm   Post subject: (No subject)

well if that gass usesg is in litters per 100km then whould it not be:

gass used = ((distance in km)/100) * gass usesge per 100km
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: