School of Computing Technologies


COSC2531 Programming Fundamentals


Assignment 1

Assessment Type: Individual assignment; no group work.

Submit online via Canvas → Assignments → Assignment 1.


Marks awarded for meeting requirements as closely as possible.

Clarifications/updates may be made via announcements/relevant discussion forums.


Due date: end of Week 6; Deadlines will not be advanced but they may be extended.

Please check Canvas → Assignments → Assignment 1 for the most up to date information.


As this is a major assignment, a university standard late penalty of 10% per each working day applies for up to 5 working days late, unless special consideration has been granted.


Weighting: 20 marks out of 100


1. Overview

The objective of this assignment is to develop your programming and problem solving skills in a stepby-step manner. The different stages of this assignment are designed to gradually introduce different concepts, such as loops, arrays, and methods. Students may be awarded partial marks for explaining a valid strategy, even if the program is not working.

Develop this assignment in an iterative fashion (as opposed to completing it in one sitting). You can and should get started now as there are concepts from the week 1 lessons that you can incorporate from now itself.

If there are questions, you must ask via the relevant Canvas discussion forums in a general manner (replicate your problem in a different context in isolation before posting).


2. Assessment Criteria

This assessment will determine your ability to:

1. Follow coding, convention and behavioral requirements provided in this document and in the lessons.

2. Independently solve a problem by using programming concepts taught over the first several weeks of the course.

3. Write and debug Python code independently.

4. Document code.

5. Ability to provide references where due.

6. Meeting deadlines.

7. Seeking clarification from your “supervisor” (instructor) when needed via discussion forums.,

8. Create a program by recalling concepts taught in class, understanding and applying concepts relevant to solution, analysing components of the problem, evaluating different approaches.


3. Learning Outcomes

This assessment is relevant to the following Learning Outcomes:

1. Demonstrate knowledge of basic concepts, syntax and control structures in programming

2. Devise solutions to simple computing problems under specific requirements

3. Encode the devised solutions into computer programs and test the programs on a computer

4. Demonstrate understanding of standard coding conventions and ethical considerations in programming.


4. Assessment details

Note: Please ensure that you have read sections 1-3 of this document before going further. Your code must meet the following code and documentation requirements.

Suppose you are contracted to write a simple program for a warehouse to manage the inventory. You are required to implement the following functionalities:


=========== PART 1 ===========


At this part, you program can perform simple interactions with user.

1. Display a message asking the user to enter the name of the customer.

2. Display a message asking the user to enter the name of a product.

3. Display a message asking the user to enter the quantity of the product ordered by the customer that was entered earlier. Assume the quantity is always an integer e.g. 4, 8, 22…

4. Calculate the total price for the customer including the discount (see No. 7 below).

5. You program should have a list to store customer names, and a list to store product names. Every product has a price in dollar e.g. $58.85, $0.50, $3990. You can assume product names and customer names are all unique.

6. In you program, write a short explanation on how products and their price are stored.

7. Your program will go through the customer list and the product list. For an existing customer, 10% discount will apply. No discount for new customers. Your program is now able to calculate the total price. Assume the search is case-sensitive e.g. John john johN.

8. The total price will be displayed as a formatted message to the user, e.g.

<customer name> purchased <quantity> x <product name>


Unit price: <product price>


Total price: <total price>




=========== PART 2 (Do not attempt this part before completing Part 1) ===========


At this part, you program can be operated using a menu to do the following:

1. Display an error message if the product name entered by the user does not exist in the list. If that occurs, the user will be given another chance, until an existing product is entered.

2. Display a message asking the user to enter a list of products. If there is already a product list, it will be replaced by the new list. You can assume the product names are always unique. Every product name is a single word with no space but only alphanumeric characters.

3. Allow user to enter the prices as well. The newly entered prices will replace existing prices. The prices may be entered as a list. You can assume the order is the same as the order of products. For example if “1 2 3.5” is the price list for products “A B C D E”, A, B, C are then set prices as $1, $2 and $3.5 respectively.

4. A product may have no price. Products D and E in the above example have no price.

5. When a new customer made an order, this customer will be added to the customer list so the 10% discount will apply for all further purchases from this customer. You can assume duplicate names never happen.

6. Display all the existing customers on screen.

7. Display all the products in the list on screen, with their prices. Products with no price will also be displayed.

8. When a task is accomplished, the menu will appear again for the next task. The program always exits gracefully from the menu, e.g. there is an exit option on the menu.


=========== PART 3 (Do not attempt this part before completing Part 2) ===========


At this part, you program is equipped with some advanced features. Note some features may be challenging.

1. All negative prices are treated as no price or price unknown. A product with no price cannot be sold. An error message will show if the user attempts to order such products.

2. A new customer cannot order a free product, e.g. its price is zero.

3. Through the menu, user can invoke a function named as “replenish”, which sets the stock of all products to a number entered by the user. For example, if the user entered 50, then every product will have 50 in stock.

4. If a product does not have enough stock, the order will not proceed.

5. The menu now has an option to reveal the most valuable customer. That is based on the total order value. Note, one customer may have multiple orders.

6. Display the order information as a table to show who ordered what. For example

P1          P2         P3         P4

Linda           2           0           15         0

Jack            0            5           0          0

Zoran          10          0           0          11

Note: you can assume the product and the price lists will not change during these Part 3 operations, although updating products and prices is a routine operation in reality.


=========== Embedded Documentation ===========


You are encouraged to write a short analysis or discussion or reflection as a part of your code, for example how your code could be improved if you have more time, which part you find most challenging, what features are missed etc. Writing documentation is a good habit in professional programming. It is particularly useful if the doc is next to the code segment that it refers to.

No need to write an essay. Keep it succinct. See more on Documentation requirements below.


The following code requirements must be applied in a fashion similar to what has been shown in lesson materials.

The program must be entirely in one Python class/file ProgFunA1_.py Other names will not be accepted.

Code formatted consistently. Must not include any unused/irrelevant code (even inside comments); what is submitted must be considered the final product.

Use appropriate data types and handle user inputs properly.

Must not have redundant conditions/parts in your statements.

Students must demonstrate their ability to manipulate (standard) Python lists on their own without using external classes/libraries.

In places where this specification may not tell you how exactly you should implement a certain feature, you need to use your judgment to choose and apply the most appropriate concepts from our course materials. Follow answers given by your “client” or “supervisor” (the teaching team) under Canvas→Discussions→’Assignment 1’ when in doubt.


Documentation requirements

Write comments in the same Python file, before code blocks (e.g. before methods, loops, ifs, etc) and important variable declarations. DO NOT write a separate file.

The comments in this assignment should serve the following purposes:

Explain your code in a precise but succinct manner. It should include a brief analysis of your approaches and evaluation instead of simply translating the Python code to English. For example why you choose while loop instead of other loops, how order information are managed in your method, why you introduce a particular function or method not specified in the assignment specification.

Document any problems of your code and requirements that you have not met. For example, situations that might cause the program to crash or behave abnormally, or ideas/attempts for completing a certain functionality. Write these in the approximate locations within your code.

No need to handle or address errors that are not covered yet.


5. Referencing guidelines

What: This is an individual assignment and all submitted contents must be your own. If you have used sources of information other than the contents directly under Canvas→Modules, you must give acknowledge the sources and give references using IEEE referencing style.

Where: Add a code comment near the work to be referenced and include the reference in the IEEE style.

How: To generate a valid IEEE style reference, please use the citethisforme tool if unfamiliar with this style. Add the detailed reference before any relevant code (within code comments).


6. Submission format

Submit one file ProgFunA1_.py showing the final output of your program via Canvas→Assignments→Assignment 1. It is the responsibility of the student to correctly submit their files. Please verify that your submission is correctly submitted by downloading what you have submitted to see if the files include the correct contents.


7. Academic integrity and plagiarism (standard warning)

Academic integrity is about honest presentation of your academic work. It means acknowledging the work of others while developing your own insights, knowledge and ideas. You should take extreme care that you have:

Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you have quoted (i.e. directly copied), summarised, paraphrased, discussed or mentioned in your assessment through the appropriate referencing methods,

Provided a reference list of the publication details so your reader can locate the source if necessary. This includes material taken from Internet sites.

If you do not acknowledge the sources of your material, you may be accused of plagiarism because you have passed off the work and ideas of another person without appropriate referencing, as if they were your own.

RMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarism covers a variety of inappropriate behaviours, including:

Failure to properly document a source

Copyright material from the internet or databases

Collusion between students

For further information on our policies and procedures, please refer to the University website.


8. Assessment declaration

When you submit work electronically, you agree to the assessment declaration.


Rubric (see more details on Canvas)

  Assessment Task
  Marks
  Part 1 Functionalities
  5 marks
  Part 2 Functionalities
  6 marks
  Part 3 Functionalities
  6 marks
  Others
  1. Code quality and style
  2. Modularity / Use of methods
  3. Comments / Analysis/ Reflection
  1 + 0.5 + 1.5 marks