Python
Assignment1_Jc433987_Rakshith/IPO_Rakshith.docx
ASSESSMENT TASK [INSERT NUMBER] COLLEGE OF [INSERT COLLEGE]
|
|
CP1401: Subject title |
INDIVIDUAL TASK COVER SHEET
|
Student Please sign, date and attach cover sheet to front of assessment task for all hard copy submissions |
|||||||||
|
SUBJECT CODE |
CP1401 |
||||||||
|
STUDENT FAMILY NAME |
Student Given Name |
JCU Student Number |
|||||||
|
Rajendra |
Rakshith |
1 |
3 |
3 |
5 |
2 |
7 |
3 |
2 |
|
ASSESSMENT TITLE |
TROPICAL AIR INSTRUCTION |
||||||||
|
DUE DATE |
5th December |
||||||||
|
LECTURER NAME |
SHAILEY CHAWLA |
||||||||
|
TUTOR NAME |
SHAILEY CHAWLA |
||||||||
|
Student Declaration 1. This assignment is my original work and no part has been copied/ reproduced from any other person’s work or from any other source, except where acknowledgement has been made (see Learning, Teaching and Assessment Policy 5.1). 2. This work has not been submitted for any other course/subject (see Learning, Teaching and Assessment Policy 5.9). 3. This assignment has not been written for me. 4. I hold a copy of this assignment and can produce a copy if requested. 5. This work may be used for the purposes of moderation and identifying plagiarism. 6. I give permission for a copy of this marked assignment to be retained by the College for benchmarking and course review and accreditation purposes. Learning, Teaching and Assessment Policy 5.1. A student who submits work containing plagiarised material for assessment will be subject to the provisions of the Student Academic Misconduct Requirements. Note definition of plagiarism and self plagiarism in Learning, Teaching and Assessment Policy: Plagiarism: reproduction without acknowledgement of another person’s words, work or expressed thoughts from any source. The definition of words, works and thoughts includes such representations as diagrams, drawings, sketches, pictures, objects, text, lecture hand-outs, artistic works and other such expressions of ideas, but hereafter the term ‘work’ is used to embrace all of these. Plagiarism comprises not only direct copying of aspects of another person’s work but also the reproduction, even if slightly rewritten or adapted, of someone else’s ideas. In both cases, someone else’s work is presented as the student’s own. Under the Australian Copyright Act 1968 a copyright owner can take legal action in the courts against a party who has infringed their copyright. Self Plagiarism: the use of one’s own previously assessed material being resubmitted without acknowledgement or citing of the original. Student Signature … Rakshith Rajendra … Submission Date 5th December , 2019 |
Individual Task Cover Sheet (Version January 2017)
IPO TABLE FOR main() function:
|
Input |
Processing |
Output |
|
Name
|
Call to the function menu() |
Prints a welcome message and name |
IPO for the def main():
def main():
name = input("What is your name?")
global NAME
NAME = name
print("Welcome", NAME)
menu()
Ipo for age function :
|
Input |
processing |
output |
|
Name, location, total fare, class and seat location |
Checks person’s age and based on that ticket fare is calculated |
Displays the ticket with details and fare |
def age(nAME, lOCATION, tOTAL, cLASS, sEATLOC):
print("How old is the person travelling."&&"Travellers under 16 years old will receive promotion of 50% discount for the fare.").
age = int(input())
if age > 0 and age < 16:
tOTAL = float(tOTAL) / 2
print("Calculating Fare..")
print("Ticket for: " + nAME + " LOCATION: " + lOCATION + " CLASS: " + cLASS + " SEATLOC: " + sEATLOC)
print("TOTAL FARE: " + tOTAL)
else:
print("Calculating Fare..")
print(" Ticket for: " + nAME + " LOCATION: " + lOCATION + " CLASS: " + cLASS + " SEATLOC: " + sEATLOC)
print("TOTAL FARE: " + tOTAL)
Ipo for menu function:
|
Input |
Processing |
output |
|
get user choice |
If its I displays information if it is o displays name and if its e then display thank you |
Display the information or display name or display thank you for visiting the airlines. |
def menu(name):
print("Tropical Airlines Ticket Ordering System")
print("(I)nstructions /n(O)rder Ticket /n(E)xit")
userchoice = input()
if userchoice == "I"||userchoice == "i":
print("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")
else:
if userchoice == "O"||userchoice == "o":
order (name)
else:
if userchoice == "E"||userchoice == "e":
print("Thank you for visiting Tropical Airlines")
else:
menu ()
Ipo for order function:
|
Input |
Processing |
Output |
|
Name of the current passenger |
Get the input so as to know whether the ticket is for current user or another |
Get the ticket for the passanger by calling function ticket () |
def order(nAME):
print("Ticket for (Y)ou or (S)omeone else")
input = input()
if input == "Y":
ticket (nAME)
else:
print("Enter the name of the fellow passengers")
newname = input()
ticket (newname)
Ipo for seat function:
|
Input |
Processing |
Output |
|
Name, location, amount and class |
Book the seat location based on the user input(window aisle or middle) |
Calls the function age() |
def seat(nAME, lOCATION, tOTAL, var_class):
print("Please choose the seat type. Choosing the middle seat will deduct 25 from the total fare")
print("(W)indow 75(A)isle 50\\n(M)iddle - 25 ")
input = input()
if input == "W"|| input == "w":
seatloc = "WINDOW - 75"
tOTAL = tOTAL + 75
else:
if input == "A"|| input == "a":
seatloc = "AISLE - 50"
tOTAL = tOTAL + 50
else:
if input == "M"|| input == "m":
seatloc = "MIDDLE - (-25)"
tOTAL = tOTAL - 25
else:
seat (nAME, lOCATION, tOTAL, var_class)
age (nAME, lOCATION, tOTAL, var_class, seatloc)
Ipo for seat type function:
|
Input |
Processing |
Output |
|
Name, location and amount |
Gets the seat class from the user |
Based on the class seat() function is called |
def seattype(name, location, totalfare):
name = name
location = location
tOTAL = totalfare
print("Please choose the type of fare. Fees are displayed below and are in addition to the basic fare.")
print("Please note choosing Frugal fare means you will not be offered a seat choice, it will be assigned to the ticketholder at travel time")
input = input()
if input == "B"|| input == "b":
var_class = "BUSINESS - 275"
tOTAL = tOTAL + 275
else:
if input == "E"|| input == "e":
var_class = "ECONOMY-25"
tOTAL = tOTAL + 25
else:
if input == "F"|| input == "f":
var_class = "FRUGAL-0"
else:
seattype (name, location, tOTAL)
seat (name, location, tOTAL, var_class)
IPo for ticket function:
|
Input |
Processing |
Output |
|
Name |
Gets the destination and trip type(one way or round trip) from user |
Based on the input from user call seattype() function |
def ticket(name):
cALLBACK = name
print("Please choose a destination and trip length. Fare choices are" + "displayed below")
print("(C1) Cairns One Way – 250" + "(C2) Cairns Return – 400" + " " + "(S1) Sydney One Way – 420" + "(S2) Sydney Return – 575" + " " + "(P1) Perth One Way –510" + "(P2) Perth Return - 700")
input = input()
if input == "C1"|| input == "c1":
lOCATION = "(C1) Cairns One Way – 250"
tOTALFARE = 250
else:
if input == "C2"|| input == "c2":
lOCATION = "(C2) Cairns Return – 400"
tOTALFARE = 400
else:
if input == "S1"|| input == "s1":
lOCATION = "(S1) Sydney One Way – 420"
tOTALFARE = 420
else:
if input == "S2"|| input == "s2":
lOCATION = "Sydney Return – 575"
tOTALFARE = 575
else:
if input == "P1"|| input == "p1":
lOCATION = "(P1) Perth One Way –510"
tOTALFARE = 510
else:
if input == "P2"|| input == "p2":
lOCATION = "(P2) Perth Return - 700"
tOTALFARE = 700
else:
ticket (cALLBACK)
seattype (name, lOCATION, tOTALFARE)
Pseudocode:
def age(nAME, lOCATION, tOTAL, cLASS, sEATLOC):
OUTPUT "How old is the person travelling. Travellers under 16 years old will receive a 50% discount for the child fare."
ENDFOR
age <- int(input())
IF age > 0 AND age < 16:
tOTAL <- float(tOTAL) / 2
OUTPUT "Calculating Fare.."
OUTPUT "Ticket for: " + nAME + " LOCATION: " + lOCATION + " CLASS: " + cLASS + " SEATLOC: " + sEATLOC
ENDFOR
OUTPUT "TOTAL FARE: " + tOTAL
ELSE:
OUTPUT "Calculating Fare.."
OUTPUT " Ticket for: " + nAME + " LOCATION: " + lOCATION + " CLASS: " + cLASS + " SEATLOC: " + sEATLOC
ENDFOR
OUTPUT "TOTAL FARE: " + tOTAL
ENDIF
ENDFUNCTION
FUNCTION menu(name):
OUTPUT "Tropical Airlines Ticket Ordering System"
OUTPUT "(I)nstructions /n(O)rder Ticket /n(E)xit"
userchoice <- input()
IF userchoice = "I"|| userchoice = "i":
ENDFOR
ELSE:
IF userchoice = "O"|| userchoice = "o":
order (name)
ELSE:
IF userchoice = "E"|| userchoice = "e":
OUTPUT "Thank you for visiting Tropical Airlines"
ENDFOR
ELSE:
menu ()
ENDIF
ENDIF
ENDIF
ENDFUNCTION
FUNCTION order(nAME):
OUTPUT "Ticket for (Y)ou or (S)omeone else"
ENDFOR
input <- input()
IF input = "Y":
ticket (nAME)
ELSE:
OUTPUT "ENter the name of the fellow passenger"
newname <- input()
ticket (newname)
ENDIF
ENDFUNCTION
FUNCTION seat(nAME, lOCATION, tOTAL, var_class):
ENDCLASS
OUTPUT "Please choose the seat type. Choosing the middle seat will deduct 25 from the total fare"
OUTPUT "(W)indow 75(A)isle 50\\n(M)iddle - 25 "
input <- input()
IF input = "W"|| input = "w":
seatloc <- "WINDOW - 75"
tOTAL <- tOTAL + 75
ELSE:
IF input = "A"|| input = "a":
seatloc <- "AISLE - 50"
tOTAL <- tOTAL + 50
ELSE:
IF input = "M"|| input = "m":
seatloc <- "MIDDLE - (-25)"
tOTAL <- tOTAL - 25
ELSE:
seat (nAME, lOCATION, tOTAL, var_class)
ENDIF
ENDIF
ENDIF
ENDCLASS
age (nAME, lOCATION, tOTAL, var_class, seatloc)
ENDFUNCTION
ENDCLASS
FUNCTION seattype(name, location, totalfare):
name <- name
location <- location
tOTAL <- totalfare
OUTPUT "Please choose the type of fare. Fees are displayed below AND are in addition to the basic fare."
OUTPUT "Please note choosing Frugal fare means you will not be offered a seat choice, it will be assigned to the ticketholder at travel time"
input <- input()
IF input = "B"|| input = "b":
var_class <- "BUSINESS - 275"
ENDCLASS
tOTAL <- tOTAL + 275
ELSE:
IF input = "E"|| input = "e":
var_class <- "ECONOMY-25"
ENDCLASS
tOTAL <- tOTAL + 25
ELSE:
IF input = "F"|| input = "f":
var_class <- "FRUGAL-0"
ENDCLASS
ELSE:
seattype (name, location, tOTAL)
ENDIF
ENDIF
ENDIF
seat (name, location, tOTAL, var_class)
ENDFUNCTION
ENDCLASS
FUNCTION ticket(name):
cALLBACK <- name
OUTPUT "Please choose a destination AND trip length. Fare choices are" + "displayed below"
OUTPUT "(C1) Cairns One Way – 250" + "(C2) Cairns Return – 400" + " " + "(S1) Sydney One Way – 420" + "(S2) Sydney Return – 575" + " " + "(P1) Perth One Way –510" + "(P2) Perth Return - 700"
input <- input()
IF input = "C1"|| input = "c1":
lOCATION <- "(C1) Cairns One Way – 250"
tOTALFARE <- 250
ELSE:
IF input = "C2"|| input = "c2":
lOCATION <- "(C2) Cairns Return – 400"
tOTALFARE <- 400
ELSE:
IF input = "S1"|| input = "s1":
lOCATION <- "(S1) Sydney One Way – 420"
tOTALFARE <- 420
ELSE:
IF input = "S2"|| input = "s2":
lOCATION <- "Sydney Return – 575"
tOTALFARE <- 575
ELSE:
IF input = "P1"|| input = "p1":
lOCATION <- "(P1) Perth One Way –510"
tOTALFARE <- 510
ELSE:
IF input = "P2"|| input = "p2":
lOCATION <- "(P2) Perth Return - 700"
tOTALFARE <- 700
ELSE:
ticket (cALLBACK)
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
seattype (name, lOCATION, tOTALFARE)
# Main
ENDFUNCTION
OUTPUT "What is your name?"
name <- input()
OUTPUT "Welcome, " + name
menu (name)
FLOWCHART:
------------------------------------------------EOF---------------------------------------------------------
Assignment1_Jc433987_Rakshith/sa.fprg