Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CodeProject
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.
 
e.g:
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: }
#{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 : }
#{Class : Class/Section (Mr.Sze) }
#{Due Date : <january,28,> }
 
import random
import math
import time
 
iend=1
icounter=0
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
else:
ix = ix - ixdeducted
else:
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
else:
iy = iy - iydeducted
else:
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
else:
iz = iz - izdeducted
else:
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
print "you do not have enough fuel,please make an emergency landing"
iend==0
else:
print "you have enough fuel to land, please proceed"
Posted 27-Jan-13 16:04pm
jwingxx102
Edited 27-Jan-13 16:06pm
v2

1 solution

Rate this: bad
good
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.
 
—SA
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 250
1 George Jonsson 175
2 Jochen Arndt 150
3 Kornfeld Eliyahu Peter 149
4 PIEBALDconsult 110
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2014
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