Reference no: EM132969592
COSC2531 Programming Fundamentals - RMIT University
1. Overview
The objective of this assignment is to develop your programming and problem-solving skills in a step-by-step manner. The different stages of this assignment are designed to gradually introduce different basic programming concepts.
You should develop this assignment in an iterative fashion (as opposed to completing it in one sitting). You can and should get started now (when this assignment specification is posted on Canvas) as there are concepts from previous lessons that you can employ to do this assignment.
If there are questions, you can ask via the lectorial, practical sessions or the Canvas discussion forum (Canvas/Discussions/Discussion on Assessment 1). Note that the Canvas discussion forum is preferable as it allows other students to see your questions as well. Also, you should ask questions in a general manner, for example, you should replicate your problem in a different context in isolation before posting, and you must not post your code on the Canvas discussion forum.
Assessment Criteria
This assignment will determine your ability to:
i. Follow coding, convention and behavioural requirements provided in this document and in the course lessons;
ii. Independently solve a problem by using programming concepts taught over the first several weeks of the course;
iii. Write and debug Python code independently;
iv. Document code;
v. Provide references where due;
vi. Meet deadlines;
vii. Seek clarification from your "supervisor" (instructor) when needed via the Canvas discussion forums; and
viii. Create a program by recalling concepts taught in class, understand and apply concepts relevant to solution, analyse components of the problem, evaluate different approaches.
Learning Outcomes
This assignment is relevant to the following Learning Outcomes:
1. Analyse simple computing problems.
2. Devise suitable algorithmic solutions and code these algorithmic solutions in a computer programming language.
3. Develop maintainable and reusable solutions.
Specifically, upon the completion of this assignment, you will be able to:
• Demonstrate knowledge of basic concepts, syntax and control structures in programming
• Devise solutions for simple computing problems under specific requirements
• Encode the devised solutions into computer programs and test the programs on a computer
• Demonstrate understanding of standard coding conventions and ethical considerations in programming
Problem Overview: In this assignment, you are developing a bus booking system for a travel agency which delivers bus services from Melbourne to other destinations in Australia. The agents from the travel agency are the ones that use this system to book trips for customers. You are required to implement the program following the below requirements.
Requirements: Your code must meet the following functionalities, code and documentation requirements. Your submission will be graded based on the rubric published on Canvas. Please ensure you read all the requirements and the rubric carefully before working on your assignment.
PART 1
In this part, your program can perform some simple interactions with users (i.e. the travel agents):
1. Display a message asking the user to enter the name of the customer.
2. Display a message asking the user to enter the destination the customer chooses. You can assume the destination to be entered is always a valid destination.
3. Display a message asking the number of tickets the customer books for the destination that was entered earlier. You can assume the quantity to be entered is always a positive integer,
e.g. 1, 2, 3 ...
4. Calculate the total cost for the customer including the discount (see No. 5 below).
5. For customers with membership, 5% discount will apply. No discount for customers without membership.
6. The total cost will be displayed as a formatted message to the user, e.g.
<customer name > books <quantity> tickets to <destination>.
<customer name> gets a discount of <discount percentage>%. Unit price: <the price of each ticket> (AUD)
Total price: <the total price> (AUD)
7. In the program, you should have some lists (or dictionaries or other data types) to store the names of all customers, the names of customers with membership, the available destinations, the prices corresponding to those destinations. You can assume the customer names and the destinations are all unique and case sensitive.
8. When a new customer books a trip, add the customer name to the customer list. Also, when any customer books a trip, check if they have a membership; if they currently don't have a membership, display a message asking if they want to have a membership. If yes, then add the customer name to the customers with membership list. The discount is applied immediately after the customer is added to the customers with membership list. You can assume the answer entered is always either y or n (meaning yes or no, respectively).
9. Note: in the requirements No. 7 & 8, we use the term 'list' when describing the customer list, customer with membership list, etc. But you can use other data types to store this information such as dictionaries and other data types. Make sure you think and analyse the requirements in detail so that you can choose the most appropriate/suitable data types.
PART 2
In this part, your program can: (a) perform some additional requirements compared to PART 1, and
(b) be operated using a menu.
First, compared to the requirements in PART 1, now your program can:
1. Display an error message if the destination entered by the user does not exist in the destination list. When this error occurs, the user will be given another chance, until a valid destination is entered.
2. Display an error message if the ticket quantity is 0, negative or not an integer. When this error occurs, the user will be given another chance, until a valid positive integer quantity is entered.
3. Display an error message if the answer by the user is not y or n when asking if the customer wants a membership. When this error occurs, the user will be given another chance, until a valid answer (i.e. y, n) is entered.
Second, your program will be operated using a menu. A menu-driven program is a computer program in which options are offered to the users via the menu. Your program will have the following options: book a new trip, add a new destination, display all existing customers, display all customers with membership, display all valid destinations with their prices, exit the program. Below are the specifications of the options:
1. Book a new trip: this option includes all the requirements from 1 to 8 in PART 1 and the requirements 1 to 3 in the first part of PART 2.
2. Add a new destination: this option displays a message asking user to add a new destination, and another message asking user to enter the price of the added destination. User can add multiple destinations (and their prices) in a sequential manner. That is, after adding one new
destination and its price, the user will be asked if they want to add another destination. Besides, if the destination already exists in the current destination list, the user will be given another chance, until a new destination is entered. You can assume the price entered is always a valid number. If the price is negative or 0, then display a message asking user to enter again until the price is positive.
3. Display all existing customers: this option displays the names of all existing customers on screen.
4. Display all customers with membership: this option displays the names of all customers with membership on screen.
5. Display all valid destinations: this option displays all the destinations on screen, with their prices.
6. Exit the program: this option allows users to exit the program.
Note that in your program, when a task (option) is accomplished, the menu will appear again for the next task.
PART 3
In this part, your menu program is equipped with some advanced features. Note, some features maybe challenging.
1. In the Book a new trip option: now the program will also display a message asking if customer wants to order extra service (apart from the bus tickets). If yes, display a message asking which extra service customer wants to order. The available extra services are internet, snack, drink. Their corresponding prices are 0, 10, 5 respectively. Customer can only order one extra service. Note that:
a. The total price is the tickets price and the extra service price.
b. The 5% discount is only applied to the tickets price.
c. Only customers with membership can order free extra service (i.e. services with price of 0).
d. Display an error message if the answer by the user is not y or n when asking if customer wants to order extra service. When this error occurs, the user will be given another chance, until a valid answer (i.e. y, n) is entered.
e. Modify the cost formatted message (in PART 1) to be as follows.
<customer name > books <quantity> tickets to <destination>.
<customer name> gets a discount of <discount percentage>%. Unit price: <the price of each ticket> (AUD) Extra service price: <the price of the extra service> (AUD) Total price: <the total price> (AUD)
2. The menu now has an option to reveal the most valuable customer. That is the customer with maximum total money spent to date. If there are multiple customers with the same maximum money spent, you just need to display one customer.
3. The menu also has an option to display the customer order history. The option will display a message asking user to enter the name of the customer, and the program will display all the previous orders of that customer, including the destinations they book and the corresponding number of tickets. For example, if a customer named James booked 10 tickets to Sydney, 1 ticket to Adelaide, 4 tickets to Sydney, 5 tickets to Canberra previously, then the program will display the formatted message as follows.
This is the order history of James. Destination Number of tickets
Sydney: 10
Adelaide: 1
Sydney: 4
Brisbane: 5
Note that for this option, if the user enters non-existing customer, then your program needs to give the user another chance, until an existing customer is entered.
Attachment:- Programming Fundamentals.rar