Click here to Skip to main content
12,947,948 members (81,832 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello i have a code project due tomorrow that i couldn't do because of exam studying. Aside from all my excuses, my teacher wants me to do a code that simulates an airplane control center. The expectations are to output the inserted x,y,z coordinates and keep decreasing them by one every second until the the distance is 15 and tells the pilot whether or not he/she has enough fuel to land. If not he/she must make an emergency landing. the output should be for example.

you are now at __ x coordinate
you are now at __ y coordinate
you are now at __ z coordinate
you are going at __ speed, Total flight time is __
you are __ away from landing. (distance)

the code has to be very basic as im only in grade 10 and my teacher wants only simple code. What i've done so far only outputs the x,y,z.

Please help me, many thanks in advance.

(this is what i have so far)
#{Filename: <airplane control=""> }
#{Program : At 20 distance of the landing it tells the pilot if help/she
#has enough fuel or not and outputs the coordinates.}
#{Outline program. checks if you plane is at 20 distance if it isnt it
#decreases by one and keeps looping until its 20}
#{Programmer : <james cui=""> }
#{Class : Class/Section (Mr.Sze) }
#{Due Date : <january,28,> }

import random
import math
import time

iconsump=50 #per hour
idestination= (0,0,0)
ix= input ("please enter your x coord")
iy= input ("please enter your y coord")
iz= input ("please enter your z coord")
ispeed= input ("please enter the speed of your plane")
ifuel= input ("please enter your fuel")
idistance= math.sqrt((ix)^2+(iy)^2+(iz)^2)
itime= idistance/ispeed
iremain= itime*iconsump
iwind= random.randrange (1,50)

while iend > 0:
ixdeducted = random.randint(1,2)
if ix > 0:
if ix == 1:
ix = ix - 1
ix = ix - ixdeducted
ix = ix + 0
print "You are now at",ix,"on the X coordinate."
iydeducted = random.randint(1,2)
if iy > 0:
if iy == 1:
iy = iy - 1
iy = iy - iydeducted
iy = iy + 0
print "You are now at",iy,"on the Y coordinate."
izdeducted = random.randint(1,2)
if iz > 0:
if iz ==1:
iz = iz -1
iz = iz - izdeducted
iz = iz + 0
print "You are now at",iz,"on the Z coordinate."
print "You were flying for a total of",itime,"hours"

if idistance<=15:
if ifuel<iremain: xmlns:iremain="#unknown">
print "you do not have enough fuel,please make an emergency landing"
print "you have enough fuel to land, please proceed"
Posted 27-Jan-13 15:04pm
Updated 27-Jan-13 15:06pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is not a question. It looks like you want other people to do your work for you. Besides, you want to cheat against your fellows who are doing things with your hands.

However, they are not going to be the losers, but you are. You are given a change to learn something; use this chance well. It will only work for you if you do it by yourself.

Sorry, you are not doing your work for you. We are helping people; and the best help you need right now is: get to work.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,344
CHill60 3,275
Maciej Los 2,628
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170518.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100