ISY1003 Foundations of Programming Assignment - Australian Institute of Higher Education, Australia
Unit Learning Outcome -
- Describe and discuss the elements of effective programming style.
- Demonstrate an understanding of the software development life cycle and apply sound programming analysis techniques (design, coding, debugging, testing and documentation) to justify simple programming problems.
GET READYMADE ISY1003 FOUNDATIONS OF PROGRAMMING ASSIGNMENT SOLUTIONS - 100% PLAGIARISM FREE WORK DOCUMENT AT NOMINAL CHARGES!
In this project, you will work individually to write programs which demonstrate your understanding of IPO and usage of simple functions in Python programs.
Program - Your program will be used by the staff who work for an airline company, e.g. Qantas Airways.
The airline has a range of flights between various cities each day. Customers can book to fly on a flight, and if circumstances change they can cancel their booking at a later time, but not when it is less than 2 hours until the flight. The client want you to make a program that can be used to store the booking information, and the check-in information of the people on a flight.
Answer - Program for booking flights by customers
#flight class to store flight information
class flight:
#creating new flight
def __init__(self,flightCode,source,destination,noOfSeatsBooked,noOfSeatsAva,fare,time):
self.flightCode=flightCode
self.source=source
self.dest=destination
self.noOfBookedseats=noOfSeatsBooked
self.noOfSeatsAva=noOfSeatsAva
self.fare=fare
self.departureTime=time
#updating seat information after booking successful
def updateseatBooking(self):
self.noOfBookedseats+=1
self.noOfSeatsAva-=1
#updating seat information after ticket cancellation successful
def updateseatCancel(self):
self.noOfBookedseats-=1
self.noOfSeatsAva+=1
#customer class to store customer information
class customer:
#creating new customer
def __init__(self,name,address,PassCode,eatHalal):
self.name=name
self.address=address
self.passCode=PassCode
self.eatHalalStatus=eatHalal
class booking:
#creating new booking
def __init__(self,customer,flight,timeOfBooking):
self.customer=customer
self.flight=flight
self.timeOfBooking=timeOfBooking
#checking whether the customer already booked in the flight
def checkbooking(bookings,f,c):
for i in bookings:
if flights[f-1].flightCode==i.flight.flightCode and customers[c-1].name == i.customer.name:
return True
return False
#counting how many customers are eating halal meal
def halalcount(b,f):
count=0
for i in b:
if f.flightCode==i.flight.flightCode and i.customer.eatHalalStatus=='Y':
count=count+1
return count
#adding a new flight to the list of flights
def addFlight(flights,flightCodes):
code=input('Enter filght Code:')
src=input('enter Source location of flight:')
dest=input('enter Destination location of flight:')
flightcapacity=int(input('enter No. of available seats for booking in this flight(Passenger capacity of the flight) :'))
cost=int(input('enter the fare per passenger:'))
deptTime=int(input('enter the flight departure time(1 to 24):'))
temp=flight(code,src,dest,0,flightcapacity,cost,deptTime)
if code not in flightCodes:
flights.append(temp)
flightCodes.append(code)
else:
print('Already flight exists with the same flight name')
#adding a new customer to the list of customers
def addCustomer(customers):
name=input('Enter name of the Customer:')
address=input('Enter Address of the Customer:')
while(True):
passengercode=int(input('Enter 3 digit PassengerCode(should not start with zeros):'))
if(passengercode>=100):
break
else:
print('Please enter valid Passenger code. It should be greater than 100!!')
HalalEatStatus=input('Will you eat Halal?(Y/N):')
HalalEatStatus= HalalEatStatus.upper()
temp=customer(name,address,passengercode,HalalEatStatus)
customers.append(temp)
#variable creation
flights=[]
flightCodes=[]
customers=[]
bookings=[]
print('Creating list of flights')
noOfflights=int(input('enter no. of flights to be created:'))
for i in range(noOfflights):
addFlight(flights,flightCodes)
print('Creating list of Customers')
noOfCustomers=int(input('enter no. of Customers to be created:'))
for i in range(noOfCustomers):
addCustomer(customers)
while(True):
print('1. Add a new Flight\n2.Book a Flight\n3.Cancel a Flight\n4.Exit')
option=int(input('enter your option:'))
#adding new flight to the list of flights
if option==1:
addFlight(flights,flightCodes)
noOfflights+=1
#creating a new booking
elif option==2:
for i in range(noOfCustomers):
print(i+1,'.',customers[i].name)
cus=int(input('select customer(interger value):'))
for i in range(noOfflights):
print(i+1,'.',flights[i].flightCode, 'source:',flights[i].source,'Destination:',flights[i].dest)
flig=int(input('select flight(interger value):'))
timeofbooking=int(input('enter timeOfBooking(1-24):'))
#booking time should be less than flight departure time
if timeofbooking >= flights[flig-1].departureTime:
print('Booking not Allowed.Since booking time is greater than filght departure time!!')
#customer can book at most one ticket in a flight
elif checkbooking(bookings,flig,cus)==True:
print("Already You booked this flight.So booking not allowed now!!")
else:#adding booking details and booking is successful
temp=booking(customers[cus-1],flights[flig-1],timeofbooking)
bookings.append(temp)
flights[flig-1].updateseatBooking()
print('your Booking is successful')
elif option==3: #cacel booking
#displaying booking details
for i in range(len(bookings)):
print(i+1,'.','customer Name:',bookings[i].customer.name, 'flight Code:',bookings[i].flight.flightCode)
booknum=int(input('select booking to be cancelled(interger value):'))
timeofcancellation=int(input('enter timeOfCancellation(1-24):'))
print(bookings[booknum-1].flight.departureTime-timeofcancellation)
#if cancellation time is less than 2 hrs to the flight departure time then booking can not be cancelled
if (bookings[booknum-1].flight.departureTime-timeofcancellation) <=2 :
print('Your booking can not be cancelled.Sorry!!!')
else:
bookings[booknum-1].flight.updateseatCancel()
bookings.pop(booknum-1)
print('Your Booking cancelled Successfully.')
elif option==4:
break
else:
print('invalid option. Try again!!')
print('booking Summary...')
print('FlightCode\tSource\tDestination\tNo. of seats Booked\tNo. of seats Available\tNo. of customers need halal meal')
#displaying customer's Booking summary
for i in flights:
print(i.flightCode,'\t\t',i.source,'\t',i.dest,'\t\t',i.noOfBookedseats,'\t\t\t',i.noOfSeatsAva,'\t\t\t',halalcount(bookings,i))
filename=input("Enter the fileName to store this Customer's booking summary(summary.txt):")
f=open(filename,'w')
f.write('FlightCode\tSource\tDestination\tNo. of seats Booked\tNo. of seats Available\tNo. of customers need halal meal\n')
for i in flights:
f.write(i.flightCode+'\t\t'+i.source+'\t'+i.dest+'\t\t'+str(i.noOfBookedseats)+'\t\t\t'+str(i.noOfSeatsAva)+'\t\t\t'+str(halalcount(bookings,i)))
f.write('\n')
f.close()
print("Thank you!!")
MOST RELIABLE AND TRUSTWORTHY ISY1003 FOUNDATIONS OF PROGRAMMING ASSIGNMENT HELP & HOMEWORK WRITING SERVICES AT YOUR DOORSTEPS!
Access our Australian Institute of Higher Education, Australia Assignment Help for related courses and major academic units such as -
- ISY1001 Discrete Mathematics Assignment Help
- ISY2002 Information Systems Networking Essentials Assignment Help
- ISY2004 Information Systems Project Management Assignment Help
- ISY3001 e-Business Fundamentals and Systems Assignment Help
- ISY2005 Enterprise Systems Assignment Help
- IST3002 Information System Project Assignment Help
- ISY3005 Knowledge Management Assignment Help
- ISY2006 Object Oriented Programming Assignment Help
- ISY3001 e-Business Fundamentals and Systems Assignment Help
- ISY3004 e-Business Applications Assignment Help
- ISY2001 Systems Analysis & Design Assignment Help
- ISY2003 Information Security Assignment Help