Implement the Tropical Airlines program

Click here to order this assignment @Essaywriting.us.No Plagiarism.Written from scratch by professional writers.

Implement the Tropical Airlines program

Task
You are to implement (code in Python) a plane ticket ordering program as described in the following
description. Use what you have learned in class, including functions, selection, repetition and lists.
You should use any feedback that you received from Assignment 1 to improve your program flow.
Program Features:
Short description:
The program will begin by asking the user for their name, welcoming them and then displaying a
menu with three choices, as shown below. Choosing ‘Instructions’ or ‘Order’ will make the program
perform the actions described below. If the user chooses to ‘Exit’ the program will display the costs of
each order they have made using the program, and then a farewell message as described below. Any
invalid value will produce an error message. After every menu selection (other than ‘Exit’) the menu
will be displayed again.
The ‘Instructions’ option will display a short paragraph explaining the program, as shown below. The
‘Order’ option will take the user through a series of choices to order a single ticket. Once the choices
are made the program will display a summary of the user’s choices and a final total for the ticket.
After either of these options, the menu will be displayed again.
When the user chooses (E)xit, a listing of the totals from the previous orders should be displayed with
the output message “Your orders are:”, followed by the previous order totals in ascending order
(smallest to largest) and a final total of all the orders combined. Then the message “Thank you for
visiting Tropical Airlines” will be displayed.
See next page for Detailed Instructions.

See the last section of this document for sample output showing how the program
should run.
2/9
Detailed instructions:
1. Ask for the user’s name and welcome them to the ordering system, using their name
2. Show the program menu:
(I) nformation
(O)rder ticket
(E) xit
If the user chooses (I) display the following text:
“Thank you for choosing Tropical Airlines for your air travel needs. You will
be asked questions regarding what type of ticket you would like to purchase as
well as destination information. We also offer 50% discounted fares for
children.”
If the user chooses (O) then the program will begin the process of ordering a ticket, as described
below.
ALL other choices will produce an error. The menu will be displayed after every menu choice,
except (E)
3. Once the (O) option has been entered, the program welcomes the user and asks if the ticket is for
the user or for another person. If it is for another person, get the traveller’s name to display at the
end, otherwise use the user’s name. For the following instructions you will need to keep track of
the values and make all needed calculations at the end.
For this assignment you MUST ask the users for the following pieces of information in the order
given, and you MUST allow for the specific inputs shown. Real world clients will often have the
final say over the user interface, so this is a common restriction.
a. Ask if ticket will be one way or return (round trip)
b. Ask for the destination (choices are Cairns, Sydney or Perth).
c. Ask for the type of fare (Business, Economy or Frugal)
d. Ask what type of seat (Window, Aisle or Middle)
e. Ask age of person in order to check for child fare
f. Show user or traveller name, choices and total
3/9
4. If user chooses (E), the program should exit with the message: “[username], your orders
are:” with a list of the ticket costs in ascending numerical order, then the message “Your
final total is:” with the combined total and then the message “Thank you for
visiting Tropical Airlines”.
Example:
“[username], your orders are: $250, $300 and $550. Your
final total is: $1100. Thank you for visiting Tropical
Airlines.”
You also must handle the situation where only one order is placed
“[username], your order is: $250. Your final total is: $250.
Thank you for visiting Tropical Airlines”.
Implementation:
Python file:
You are to divide your solution into functions, following the principles shown in class. These may
involve one for each menu option (other than Exit) as well as functions for parts of the program (e.g. a
calculating the total ticket price could be implemented as a function). For each function you are to
provide an IPO chart listing all variables which are needed for your solution. In cases where selections
are necessary you must include a suitable condition action table directly below the IPO chart. Don’t
forget the loop tables for any iterations used.
Planning document:
You also need to provide an updated version of your previous planning document showing an
algorithm in pseudocode for each function, being sure to clearly indicate input and output variables
for each. This should be based on your submission for Assignment One, with appropriate changes
being made for new functionality.
You may show your assignment to your tutor during practical time to get comments or suggestions. It
is important to note that you can only get help from staff in practical time after your prac work is
finished.
4/9
General Principles:
In this assignment, you will be focusing on basic planning and implementation using selections,
repetition, and functions. Lists may be used where they are feasible.
Use the techniques and patterns that you have learned and seen demonstrated in class.
• Coding standards:
o Variables:
▪ Wherever possible, variables should be set at the top of the function
▪ Although Python does not use constants you may set variables to values that
will remain the same for the life of the program. These should be named in all
caps
• You should be able to modify these variables to adjust the various costs
of items such as one-way fare, return, discount for child tickets, etc.
This is one of the most important aspects of this assignment, so consider
carefully how to use constants. Remember to use these variables
everywhere you can.
• You will need to decide the best position to place these variables.
▪ You should AVOID the use of global variables unless they are needed in
multiple places in the application
▪ In other words, you should pass the values to any functions that need them
• And any constants only needed in one function should be ONLY in that
function
▪ Variables should be named appropriately using either camelCase or
under_scores
▪ No variables should be a single character such as “x” or “y” unless they are
used in a loop as an index. Variable names should be meaningful, and describe
their use and/or purpose
▪ Any list variable should be named with plurals to show multiple data is held
(e.g. prices versus price)
o Comments:
▪ You will need to add at LEAST one comment for each function that you define
including main
▪ The comment should either be placed directly above or below the function
header
▪ The comment should describe: (a) the purpose of the function, (b) any inputs
and (c) any returned values
▪ Additional comments should be placed at any position where the functionality
of the program may be unclear
▪ All code MUST BE properly indented
o Error handling:
▪ Note that menu choice and other character selection should handle upper and
lower case letters.
• Look into the toUpper() or toLower() functions in Python
▪ You also must make sure that any functions that get input from the user do
error checking to ensure that the input is within the expected range (greater than
zero, etc).
5/9
o Output
▪ Make your output display as close as possible to the given examples, especially
formatting and layout. Use Google to find out how to display tabs and other
special characters using Python 3.
Hints:
 You may find a list variable useful for holding order costs
 You’ll need the cost of all orders to be stored in main, for display when the user quits. This
may need to be returned from a function.
 Try to use pre-defined Python functions wherever possible (such as sort, total, len)
Submission:
Submit the following files by uploading it on LearnJCU under Assessment. Name them
FirstnameLastNameA2.py or .docx.
 Python file (.py)
 Planning document in Microsoft Word format (.docx)
Due:
Submit your assignment by the date and time specified on LearnJCU.
Submissions received after this date will incur late penalties as described in the subject outline.
Integrity:
The work you submit for this assignment must be your own. You are allowed to discuss the
assignment with other students and get assistance from your peers, but you may not do anyone else’s
work for them and you may not get anyone else to do any part of your work. Programs that are
detected to be too similar to another student’s work will be dealt with promptly according to
University procedures for handling plagiarism.
If you require assistance with the assignment, please ask general questions on the itatjcu.slack.com
web site, or get specific assistance with your own work by talking with your lecturer or tutor.
Marking Scheme:
Exemplary (9 – 10) Good (7 – 8) Satisfactory (5 – 6) Limited (2 – 4) Poor (0 – 1)
Correct use of Python syntax No syntax errors that prevent
the program running as
required.
Exhibits aspects of
exemplary (left) and
satisfactory (right)
Any errors in code syntax are small
(mistyped names, or functions).
Exhibits aspects of
satisfactory (left)
and poor (right)
Code submitted does not run, and
required significant work to be
runnable
Correct use of Python
comments
All comments are correctly
inserted, clear, and
appropriate
Most comments are correctly
inserted and clear, but some
comments are not.
No comments, or all comments
are unclear or incorrect.
Effective and correct use of
variables in the
implemented solution
All variables are correctly
used. All variable names are
clear and meaningful
No inappropriate use of
global or constant variables.
Most variables are correctly created
and used
Most names are clear and
appropriate
All variables are inconsistently
used, and/or poorly named
Effective and correct use of
functions in the
implemented solution
Functions are all appropriate
and correctly used
All names are valid and
meaningful
No unnecessary inputs or
outputs
All necessary inputs and
outputs are correct
Most functions are appropriate and
correctly used
Most names are valid and meaningful
Almost no unnecessary inputs or
outputs
All necessary inputs and outputs are
correct
All functions are inappropriate or
incorrectly used
No names are valid or meaningful
Many unnecessary inputs or
outputs
Some necessary inputs and
outputs are incorrect
Effective and correct use of
branches in the
implemented solution.
The branches identified are
appropriate and correctly
used
All branches are efficient and
well designed
Most branches identified are
appropriate and correctly used
Most branches are efficient and well
designed
Almost all branches identified are
inappropriate or incorrectly used,
or there is almost no use of
branches
All branches are inefficient or
poorly designed
Effective and correct use of
loops in the implemented
solution.
All loops used are
appropriate and correctly
used
All loops exit when
appropriate
Most loops used are appropriate and
correctly used
Most loops exit when appropriate
Very few loops used are
appropriate and correctly used, or
almost no loops are used
No (or very few) loops exit when
appropriate
Example of program interaction and output. Program output is in Bold. User input is in Red
What is your name? Bob
Welcome Bob.
Tropical Airlines Ticket Ordering System
(I)nstructions
(O)rder ticket
(E)xit
U
Invalid menu choice.
Tropical Airlines Ticket Ordering System
(I)nstructions
(O)rder ticket
(E)xit
I
Thank you for choosing Tropical Airlines for your air travel needs. You will be asked questions
regarding what type of ticket you would like to purchase as well as destination information. We also
offer 50% discounted fares for children.
Tropical Airlines Ticket Ordering System
(I)nstructions
(O)rder ticket
(E)xit
O
Bob, is this ticket for:
(Y)ou
(S)omeone else
S
Please enter the name of the person travelling
Darth Vader
Is this a return trip (R) or One-Way (O)
R
Please select the destination for your return trip. Fare prices are listed below.
(C)airns – $400
(S)ydney – $575
(P)erth – $700
S
Please choose the type of fare. Fees are displayed below and are in addition to the basic fare.
Please note choosing Frugal fare means you will not be offered a seat choice.
(B)usiness – $275
(E)conomy – $25
(F)rugal – $0
E
Please choose the seat type. Choosing the middle seat will deduct 25 from the total fare.
(W)indow $75
(A)isle $50
(M)iddle -$25
W
How old is the person travelling? Travellers under 16 years old will receive a 50% discount for the
child fare.
22
Calculating fare . . .
Ticket for: Darth Vader
Sydney (return) – $575
Economy – $25
Window – $75
Age – 22 (not eligible for child ticket)
Total price: $675
Tropical Airlines Ticket Ordering System
(I)nstructions
(O)rder ticket
(E)xit
O
Bob, is this ticket for:
(Y)ou
(S)omeone else
Y
Is this a return trip (R) or One-Way (O)
O
Please select the destination for your return trip. Fare prices are listed below.
(C)airns – $250
(S)ydney – $420
(P)erth – $510
P
Please choose the type of fare. Fees are displayed below and are in addition to the basic fare.
Please note choosing Frugal fare means you will not be offered a seat choice.
(B)usiness – $275
(E)conomy – $25
(F)rugal – $0
F
How old is the person travelling. Travellers under 16 years old will receive a 50% discount for the
child fare.
12
Calculating fare . . .
Ticket for: Bob
Perth (one-way) – $575
Frugal – $0
Window – $0
Age – 12 (eligible for child ticket, 50% discount applied)
Total price: $287.50
Tropical Airlines Ticket Ordering System
(I)nstructions
(O)rder ticket
(E)xit
E
Bob, your orders are: $287.50 and $675. Your final total is: $962.50. Thank you for visiting
Tropical Airlines.