
-----------------------------------
The Stuff
Sun Jan 11, 2004 9:46 pm

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 :cry: 
I need some1 to help me with the  selecting place thing :cry: 
help with showing the car buring up fuel according to the milage :cry: 
help with the displaying how much gas is left.  :cry: 
and the refueling the car at every destination. :cry: 

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

-----------------------------------
Cervantes
Sun Jan 11, 2004 9:52 pm


-----------------------------------
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
Sun Jan 11, 2004 9:52 pm


-----------------------------------
What do you have so far?

-----------------------------------
Cervantes
Sun Jan 11, 2004 9:55 pm


-----------------------------------
my guess is nothing :P

-----------------------------------
poly
Sun Jan 11, 2004 10:04 pm


-----------------------------------
if youve been taught how to use a variable and a put, than you should easily be able to do it

-----------------------------------
Cervantes
Sun Jan 11, 2004 10:06 pm


-----------------------------------
and drawbox and get :)

-----------------------------------
The Stuff
Sun Jan 11, 2004 10:35 pm


-----------------------------------
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 :cry:  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
Sun Jan 11, 2004 10:37 pm


-----------------------------------
Attach your code

-----------------------------------
Cervantes
Sun Jan 11, 2004 10:43 pm


-----------------------------------
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 :P

-----------------------------------
The Stuff
Mon Jan 12, 2004 6:19 pm


-----------------------------------
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 :cry:   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
Mon Jan 12, 2004 6:42 pm


-----------------------------------
i have the places on certain parts on the map

-----------------------------------
McKenzie
Mon Jan 12, 2004 6:46 pm


-----------------------------------
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
Mon Jan 12, 2004 6:46 pm


-----------------------------------
the map is a bmp and i can't attach it

-----------------------------------
The Stuff
Mon Jan 12, 2004 9:13 pm


-----------------------------------
the pic is from : http://www.pmrentals.com/french_site/images/ontario.gif

thats the map. plz can some1 help me?

-----------------------------------
Dan
Mon Jan 12, 2004 9:42 pm


-----------------------------------
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

-----------------------------------
DanShadow
Tue Jan 13, 2004 9:03 am


-----------------------------------
Maybe you could just do it easy...put it in a for loop.

var km,gas:int:=0
gas:=200
for i:1..distance_to_location_in_kilometres
if km=100 then
gas:=gas-50
km:=0
end if
km:=km+1
end for

This goes through a for loop 1.. the length of the trip.A variable adds each kilometre it goes. When it hits 100 kilometres, the car loses 50 gas. This can be changed..it can lose like 1 gas every kilometre...but im not sure how much gas you want it to take per kilometre...so just edit that.
