Python Assignment

profilezzzhy666
Project.pdf

CSCI120 Programming in Python Project

Introduction

• The purpose of this project component is to provide an experience in the writing of computer programs using

Python. You will create program code in an Idle editor (or online editors), save it to your disk, and run it.

• You will gain experience in planning, writing, debugging, documenting, and running simple programs.

• In this project, you can use online resources and tutorials.

• Before writing programs, y ou will plan the programming steps and actions by writing an algorithm.

• The project will be graded for completeness and correct functioning of programs.

• In this program you will use three data files.

1. fare.txt file contains fare between two cities. You will read/find fare from this file.

2. airports.txt contains full names of the airports along with their abbreviations. You will read/find full name

of the airport from this file.

3. sales.txt stores sales information. You will add new data in it. Also, you read the last sale number from it to

compute the new same number.

• Define and call new functions, as necessary.

• Use lists, strings, methods, loops, and data validation, as required. Keep design flexible and allow future growth.

• Add comments at the start of the program to explain the program purpose, authors, and date written. Also, add

comments for all major parts of the code explaining the purpose of writing that code.

• Input prompts and output should be shown, exactly.

Write a Python program for a travel agency who sells airline tickets. The program input prompts and outputs are shown below. Your program should work exactly like this. “Notes” are not part of the input or output. They are written, merely, for your help.

Program starts here… **********************

Eastern & West Travels

Vancouver BC

************

Enter Number of Passengers : 3 (Note: Maximum 7 passengers but could increase in future.) Enter From (Airport Code) : YVR

Enter To (Airport Code) : YYZ

Enter Return or Single (R/S): R

Enter Departure Date: 2020-12-12

Enter Return Date : 2020-12-20 (Note: Ask for return date only if passenger selects R.)

Fare from YVR to YYZ: CAD 260. (Note: Get and display the fare from the given fare.txt file.)

Fare from YYZ to YVR: CAD 220. (Note: Get and display the fare from the given fare.txt file.)

Return fare for one passenger: CAD 480.

Return fare for 3 passengers: CAD 1,440.

Would like to buy the tickets (Y/N)? Y (Note: If no, restart. If yes, continue.)

Enter the name of 1st passenger: Leo Chan

Enter the name of 2nd passenger: Jagjit Singh (Note: Ask if more than 1 passenger.)

Enter the name of 3rd passenger: Peter Smith (Note: Ask if more than 2 passengers.)

(Note: Continue asking if more passengers.)

--------------

Program Output: On Screen

--------------

-------------------

Ticket Confirmation

-------------------

Sale #: 0005 (Note: Get it from the last sale number in the sales.txt.) Date: 15-Nov-2020

Passengers:

-----------

1. Leo Chan

2. Jagjit Singh

Airports:

---------

From: Toronto Pearson International Airport

To: Vancouver International Airport

Travel Dates:

-------------

Departure: 12-December-2020

Return: 20-December-2020

Trip duration: 8 days

Fare Details:

-------------

1. Passenger 1 YVR to YYZ CAD 260.00

2. Passenger 1 YYZ to YVR 220.00

------ CAD 480.00

3. Passenger 2 YVR to YYZ 260.00

4. Passenger 2 YYZ to YVR 220.00

------ 480.00

5. Passenger 3 YVR to YYZ 260.00

6. Passenger 3 YYZ to YVR 220.00

------ 480.00

--------

Total: CAD 1,440.00

--------

Confirm the sale transaction (Y/N): Y (Note: If no, restart. If yes, continue.)

--------------

Program Output: File (Note: Write (append) the sale information into the sales.txt file.) --------------

0005,20201115,YVR,YYZ,R,3,1440

System Message: The sale is recorded successful in the file. Sale Number is 0005.

Press C for Continue another booking or E for Exit:

Deliverable: 1. Algorithm: teamNumber_Algo.pdf 2. Python code file: teamNumber_Tavel.py 3. sales.txt file with at least 5 new sales transactions in it.