代写CP1404/CP5632 Assignment 1 – Travel Tracker 1.0代做Python语言

- 首页 >> Java编程

CP1404/CP5632 Assignment 1 - Travel Tracker 1.0

Task:

You are to write a Python (3) program, as described in the following information and sample output. This assignment will help you build skills using selection, repetition, file input/output, exceptions, lists,functions and string formatting. Do not define any of your own classes or use constructs that haven't been taught in this subject. Assignment 2 will build on this with more advanced constructs including dictionaries, classes and a Graphical User Interface (GUI).

Everything you need to complete this assignment can be found in the subject materials. You should find the programming guides helpful , and you are expected to follow the style. guide:

https://github.com/CP1404/Starter/wiki

Start your work by clicking this link to create a new repository in GitHub Classroom:

https://classroom.github.com/a/hxwU__xy

Do not use any other repo or a copy of this one... just use this repository!

This will give you a new repo containing starter files including a README for your project, all of which you must use. Do not add any other files in this project, and do not rename anything - just use this as your assignment repo. Do not "download" this repo, but rather clone this repo using PyCharm ("Get from VCS"). You will probably need to create and use a token to access your private repository. Do not make your repository public at any stage.

Program Overview:

This program is an interactive "travel tracker" that allows a user to track places they wish to visit and places they have already visited. The program reads and writes a list of places in a CSV file. Each place has:

•    name, country, priority, whether it is visited (v) or unvisited (n)

Users can choose to display the list of places, including the total number of places and unvisited places. The list will be sorted by visited status then by priority (increasing number). Users can add new places and mark places as visited.

They cannot change places from visited to unvisited.

Program Functionality Details:

Ensure that your program has the following features, as demonstrated in the sample output below. Your program should:

•   display a welcome message with your name in it

•   display a menu for the user to choose from

•   error-check user inputs as demonstrated in the sample output

•    load a CSV (Comma Separated Values) file of places (just once at the very start); a sample CSV file is provided for you and you must use this format (note: you're not expected to use the csv module, but you're welcome to)

•    when the user chooses display: display a neatly formatted (lined up) list of all the places with their details and the number of places left to visit. Unvisited places should have a * next to them. Note that the lining up is dynamic, based on the longest place name and country

•    when  the  user chooses  recommend:  display a  random  choice from  any available unvisited places

o if there are no unvisited places, then "No places left to visit!" should be displayed

•    when  the  user  chooses  add:  prompt  for  the  place’s  name,  country  and  priority, error-checking each of these, then add the place to the list in memory (not to the file); new places are always unvisited


•    when the user chooses mark visited: display the list of all places (same as for the display option), then allow the user to choose one place (error-checked), then change that place to visited

o if there are no unvisited places, then "No unvisited places" should be displayed

•    when the user chooses quit: save the places to the CSV file, overwriting the file contents (note that this should be the only time that the file is saved)

Coding Requirements:

1.  Work incrementally on this task: complete small parts of it at a time rather than trying to get it all working at once.

2.  You are assessed on your use of version control including commits and commit

messages, so please commit regularly (each logical chunk or milestone) and use meaningful commit messages in the imperative voice, as taught in class. Your commits should show steady work completed over reasonable time, not all in a short period.

3.  Edit the module docstring at the very top of your code file to contain your own details.

4.  Make use of named constants as appropriate (e.g., for the characters that represent the place's visited/unvisited status).

5.  Use functions appropriately for each significant part of the program: this is the divide- and-conquer problem-solving approach. Follow the principles you've learned about functions, including the single responsibility principle (SRP).

6.  Only load (read) the places file once, when the program starts.

7.  Only save (write) the places file once, when the program ends.

8.  Store the place data in a list of lists and pass this to any functions that need access to it. Do not store a place's index – this is just its position in the list.

9.  Do not use any global variables. The only globals you may have are CONSTANTS. If you use global variables, your functions will be poorly designed.

10.Use exception handling where appropriate to deal with input errors (including entering numbers and selecting places). You should be able to use generic, customisable functions to perform. input with error checking (e.g., getting the place name and country can reuse the same function).

11.The output shows that the solution does not require correct plurals (e.g., "1 places").

You are welcome to leave yours this way. You may add logic to print these statements correctly, but it is not expected or assessed.

Check the rubric carefully to understand how you will be assessed. There should be no surprises here – this is about following the patterns and practices we have taught in class.

Integrity:

The work you submit for this assignment must be your own. Submissions that are detected to be too similar to that of another student or other work (e.g., code found online or created with AI) will be dealt with according to the College procedures for handling plagiarism and may result in serious penalties.

The goals of this assignment include helping you gain understanding of fundamental programming concepts and skills, and future subjects will build on this learning. Therefore, it is important that you develop these skills to a high level by completing the work and gaining  the understanding yourself. You may discuss the assignment with other students and get assistance from your peers, but you may not do any part of anyone else’s work for them and you may not get anyone else to do any part of your work. Note that this means you should never give a copy of your work to anyone or accept a copy of anyone elsesworkincluding looking at another student's work or having a classmate look at your work.

If you require assistance with the assignment, please ask general questions on the discussion forum, or get specific assistance with your own work by talking with your lecturer or tutor.


The subject materials (lectures, practicals, textbook and other guides provided in the subject) contain all the information you need for this assignment. Do not use online resources or GenAI (e.g., Stack Overflow, ChatGPT or other forums) to find resources or assistance as this would limit your learning and would mean that you would not achieve the goals of the assignment - mastering fundamental programming concepts and skills.

Submission:

Submit your assignment1.py and README.md files in a single attempt to LearnJCU. Your Python file module docstring must contain an accurate link to your assignment GitHub repository to get any marks for version control.

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.

Sample Output:

Sample output from the program is provided below. Ensure that your program matches this, including spaces, spelling, and the formatting of the place lists. Think of this as helpful guidance as well as training you to pay attention to detail. The sample output is intended to show a large (but maybe not exhaustive) range of situations including user input error handling.

The following sample run was made using the provided CSV file, which contained:

Lima,Peru,3,n

Auckland,New Zealand,1,v Rome,Italy,12,n

It should be clear what parts of the sample are user input for this sample run.

Travel Tracker 1.0 - by Lindsay Ward

3 places loaded from places .csv

Menu:

D - Display all places

R - Recommend a random place

A - Add a new place

M - Mark a place as visited

Q - Quit

>>> oh I'm so excited :)

Invalid menu choice

Menu:

D - Display all places

R - Recommend a random place

A - Add a new place

M - Mark a place as visited

Q - Quit

>>> d


*1. Lima in Peru 3

*2. Rome in Italy 12

3. Auckland in New Zealand 1



3 places tracked. You still want to visit 2 places.

Menu:

D - Display all places

R - Recommend a random place

A - Add a new place

M - Mark a place as visited

Q - Quit

>>> R

Not sure where to visit next?

How about... Lima in Peru?

Menu:

D - Display all places

R - Recommend a random place

A - Add a new place

M - Mark a place as visited

Q - Quit

>>> r

Not sure where to visit next? How about... Lima in Peru?



Menu:

D - Display all places

R - Recommend a random place A - Add a new place

M - Mark a place as visited Q - Quit

>>> r

Not sure where to visit next? How about... Rome in Italy?

Menu:

D - Display all places

R - Recommend a random place A - Add a new place

M - Mark a place as visited

Q - Quit >>> m

3 places tracked. You still want to visit 2 places.

Enter the number of a place to mark as visited >>> why?

Invalid input; enter a valid number >>> 42

Invalid place number >>> 0

Number must be > 0 >>> 1

Lima in Peru visited!

Menu:

D - Display all places

R - Recommend a random place A - Add a new place

M - Mark a place as visited Q - Quit

>>> d

3 places tracked. You still want to visit 1 places. Menu:

D - Display all places

R - Recommend a random place A - Add a new place

M - Mark a place as visited

Q - Quit >>> a

Name:

Input can not be blank

Name: Xanadu Country:

Input can not be blank Country:

Input can not be blank Country: Atlantis

Priority: I don't know

Invalid input; enter a valid number Priority: 0

Number must be > 0 Priority: 4

Xanadu in Atlantis (priority 4) added to Travel Tracker.

At the end of this run, the saved CSV file contained:

Malaga,Spain,2,n

Auckland,New Zealand,1,v Lima,Peru,3,v

Xanadu,Atlantis,4,v Rome,Italy,12,v

Marking Scheme:

Ensure that you follow the processes and guidelines taught in class in order to produce high quality work. Do not just focus on getting the program working. This assessment rubric provides you with the characteristics of exemplary down to very limited work in relation to task criteria covering the outcomes:

•    SLO1 - develop and utilise best-practice coding techniques to develop solutions

•    SLO2 - select and apply appropriate and efficient data structures

•    SLO3 - manage software projects using version control



站长地图