CSSE1001 / 7030 Semester 1, 2019
Assignment 1 (15 Marks)
Due: Friday 29 March 2019 at 20:30
Introduction
Welcome to Travel Inspiration!
We are going to be building a travel recommendation program. Out of ideas where to travel? Travel
Inspiration has got you covered.
The program will ask the user questions about their preferences in a travel destination. It will use
these to recommend the best match in a database of potential travel destinations.
You are provided with a file travel.py, which serves as a template for the assignment. This file is
where you should write the code for your solution. The file also provides an example of how to read
the data from the database, one destination at a time. You need to implement the functionality to
question the user and perform the matching. The database is in the form of a text file,
destinations.csv. You may edit this text file to add more destinations for testing.
Overview
Tasks
This assignment is broken down into six main tasks, grouped into two categories: Coreweb
Questions & Inputs
The first task involves creating the questionnaire and prompting the user for input. Your program
must duplicate the functionality demonstrated below.
The final line of output is the recommended destination. For now, this should be None, but in the
following tasks this should be replaced with the recommended destination.
You may assume that the user will only enter valid input.
CSSE1001 / 7030 Semester 1, 2019
Required Output
Welcome to Travel Inspiration!
What is your name? Dora
Hi, Dora!
Which continent would you like to travel to?
1) Asia
2) Africa
3) North America
4) South America
5) Europe
6) Oceania
7) Antarcticaspring
4
What is money to you?
$$$) No object
$$) Spendable, so long as I get value from doing so
$) Extremely important; I want to spend as little as possible
$$$
How much crime is acceptable when you travel?
1) Low
2) Average
3) High
3
Will you be travelling with children?
1) Yes
2) No
2
Which season do you plan to travel in?
1) Spring
2) Summer
3) Autumn
4) Winter
1
What climate do you prefer?
1) Cold
2) Cool
3) Moderate
4) Warm
5) Hot
4
Now we would like to ask you some questions about your interests, on a scale
of -5 to 5. -5 indicates strong dislike, whereas 5 indicates strong interest,
and 0 indicates indifference.
How much do you like sports? (-5 to 5)
-5
CSSE1001 / 7030 Semester 1, 2019
How much do you like wildlife? (-5 to 5)
-2
How much do you like nature? (-5 to 5)
-4
How much do you like historical sites? (-5 to 5)
-1
How much do you like fine dining? (-5 to 5)
-3
How much do you like adventure activities? (-5 to 5)
-4
How much do you like the beach? (-5 to 5)
-2
Thank you for answering all our questions. Your next travel destination is:
None
User input is bold, italic and blue.
Your program must match this output exactly. Including spaces, spelling and punctuation. Your
programs will be tested using an automated system that will match your program’s output with the
expected output. A mismatch in the output will result in the test failing. Note: Option lines, i.e.
「 1) Spring」, should begin with two spaces.
Input Requirements
For name, anything is valid. For general questions, the user input will be the value to the left of the
parenthesis (i.e. 1-7 for continent; $, $$ or $$$ for money; etc.). For interest questions, the user
input will be an integer between -5 and 5, inclusive. For tasks 1 to 4, you may assume that the user
input is always valid.
Interests
Extend the matching criteria from task 3 to consider the user’s interests as well as the season factor.
To do this, let score = season_factor * interest_score, where season_factor is
defined above (e.g. destination.get_season_factor('summer')) and the interest score is
the sum of the user’s response multiplied by the destination’s score, for each interest (sports,
wildlife, nature, historical, cuisine, adventure, beach). More specifically:
interest_score = responsesports * scoresportssession
Where responseinterest is the user’s response for the given interest, and scoreinterest is the
destination’s score for the given interest (e.g. destination.get_interest_score('beach')).
Advanced Tasksapp
Input Validation
For this task you may no longer assume that the user will enter valid input.
If, for any question, the user enters invalid input, they should be asked the question again until they
enter valid input, as demonstrated in the example below.
Input Validation Example
...
How much crime is acceptable when you travel?
1) Low
2) Average
3) Highless
5
I'm sorry, but 5 is not a valid choice. Please try again.
How much crime is acceptable when you travel?
1) Low
2) Average
3) High
1
...
CSSE1001 / 7030 Semester 1, 2019
Multiple Inputs
Extend the continent and season questions to accept multiple inputs, so that the user can type in
multiple options separated by a comma, as shown below.
A destination is now considered a match if it’s continent matches one of the user’s choices (there is
no ordering; each choice is considered equally).
The season factor used in calculating the score is now the greatest factor of those matching the
user’s choice.
Extend your input validation to handle multiple inputs.
Values can be repeated (i.e. 「2,3,2」 is a valid input).
Numbers can have spaces around them (i.e. 「2, 3 ,4」 is a valid input).
Numbers can be unordered (i.e. 「1,4,3」 is a valid input).
You should first implement this task to handle the simple case, where the input does not have
repeated values, spaces or is unordered. Once this is working, then implement each type of
validation in turn. Marking will test to determine how much of the validation your implement, and
you can obtain part marks for partially implementing the validation for this section.
Multiple Inputs Example
...
Which continents would you like to travel to?
1) Asia
2) Africa
3) North America
4) South America
5) Europe
6) Oceania
7) Antarcticaelectron
1,2,7,3
...
Which seasons do you plan to travel in?
1) Spring
2) Summer
3) Autumn
4) Winter
1, 3
...
Note that the words 「continents」 and 「seasons」 are now plural.
Utility Functions
To implement the assignment you will need to use some utility functions provided in the
destinations.py file. The specific functions that you need to use for each task have been
identified in the description above. The initial code inside travel.py provides an example of using
all of these functions. The following table indicates the type of the value returned by each of the
functions.
CSSE1001 / 7030 Semester 1, 2019
Function Parameter Return Type
destination.get_name() no parameter string
destination.get_crime() no parameter string
destination.is_kid_friendly() no parameter boolean
destination.get_cost() no parameter string
destination.get_climate() no parameter string
destination.get_continent() no parameter string
destination.get_interest_score() string that is the name of the
interest
int
destination.get_season_factor() string that is the name of the
season
float
Interview
In addition to providing a working solution to the assignment problem, the assessment will involve
discussing your code submission with a tutor. This discussion will take place in week 6, during the
practical session to which you have signed up. You must attend your allocated practical session,
swapping to another session is not possible. In preparation for your discussion with a tutor you
should consider:
any parts of the assignment that you found particularly difficult, and how you overcame them
to arrive at a solution; or, if you did not overcome the difficulty, what you would like to ask the
tutor about the problem;
whether you considered any alternative ways of implementing a given function;
where you have known errors in your code, their cause and possible solutions (if known).
It is important that you can explain to your tutor the algorithmic logic of your program and how
each of the functions that you have written operates. (For example, if you have used a while loop in
a function, why this was an appropriate choice).
In the interview you must demonstrate understanding of your code. If you cannot demonstrate
understanding of your code, this may affect the final mark you achieve for the assignment. A
technically correct solution may not achieve a pass mark unless you can demonstrate that you
understand its operation.
Submission
You must submit your assignment electronically via the assignment one submission link on
Blackboard. For information on submitting through Blackboard, please read:
https://web.library.uq.edu.au...
You must submit your assignment as a single Python file called travel.py (use this name – all
lower case), and nothing else. Do not submit the destinations.csv or destinations.py files.
Do not submit any sort of archive file (e.g. zip, rar, 7z, etc.).
Late submissions of the assignment will not be marked. Do not wait until the last minute to submit
your assignment, as the time to upload it may make it late. Multiple submissions are allowed, so
ensure that you have submitted an almost complete version of the assignment well before the
submission deadline of 20:30. Your latest, on time, submission will be marked. Ensure that you
submit the correct version of your assignment.
CSSE1001 / 7030 Semester 1, 2019
In the event of exceptional personal or medical circumstances that prevent you from handing in the
assignment on time, you may submit a request for an extension. See the course profile for details
of how to apply for an extension.
Requests for extensions must be made no later than 48 hours prior to the submission deadline. The
application and supporting documentation (e.g. medical certificate) must be submitted via my.UQ.
You must retain the original documentation for a minimum period of six months to provide as
verification, should you be requested to do so.
Assessment and Marking Criteria
This assignment assesses course learning objectives: