Introduction to Programming – Hire Academic Expert

,
Page 1 of 8
School of Computing Technologies
COSC1519 Introduction to Programming 2022 S2
Assessment 2

Assessment Type: Individual assignment; no group work.
Submit online via Canvas → Assignments → Assignment 2.
Marks awarded for meeting requirements as closely as possible.
Clarifications/updates may be made via announcements/relevant discussion forums.
Due date: end of Week 8; Deadlines will not be advanced but they may be extended.
Please check Canvas → Assignments → Assignment 2 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: 40 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.

,
Page 2 of 8
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 grocery shop to manage its inventory.
You can assume user input is
always valid and would not cause data type related runtime errors,
e.g. entering letters when numbers are required.
You are required to implement the following functionalities:
=========== PART 1 ===========
At this part, you program can perform simple interactions with user using a series of methods.
1. One method is to display a message asking the user to enter the name of the customer.
2. One method is to display a message asking the user to enter the name of a product.
3. One method is to 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.5, $399. You also keep track of the stock,
e.g. how many items of a product is available.
Your program should have at least these three customers: “
Linda”, “Jack”, “Zoran” and three
products: “
apple”, “banana”, “cake” selling at the price $3.5, $6.82, $23 per unit
respectively. The initial stock of these three products are
134, 52 and 5 units respectively.
You can assume product names and customer names in this system are all unique and are all
single-word names. So there is nothing like “BBQ Chicken” or “Joe Smith”.
6. In you program, write a short explanation on how products, their price and their available stock
are stored.

,
Page 3 of 8
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. The search is
case-sensitive e.g. John ¹ john ¹ johN.
Note, Part 1 does not require the new customer to be added into the customer list. That task
is in Part 2.
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>
Example 1:
Enter customer name: Joe
New customer!
Enter product name:
apple
Enter quantity: 5
Joe purchased 5 x apple
Unit price: $3.5
Total price: $17.5
Example 2:
Enter customer name: Jack
Return customer!
Enter product name:
apple
Enter quantity: 10
Jack purchased 10 x apple
Unit price: $3.5
Total price: $31.5
9. You program will print an error and quit if there is no such product or the stock of that product
is not sufficient.
Example 1:
Enter customer name: Joe
New customer!
Enter product name:
appl
Sorry, no such product. Quit …
Example 2:
Enter customer name: Jack
Return customer!
Enter product name:
apple
Enter quantity: 200
Sorry, not enough stock. Quit …
,
Page 4 of 8
=========== PART 2 (Do not attempt this part before completing Part 1) ===========
Extend your program built for PART 1. Now you program can operate using a menu to support the
functions described in PART 1, with additional features:
1. Through the menu, the operator can list all existing customers, e.g.
Linda
Jack
Zoran
2. Through the menu, the operator can view all products with their information, e.g.
apple, $3.5, 134
banana, $6.82, 52
cake, $23, 5
Note: no unnecessary decimal point nor unnecessary digits will display, e.g. no $23.0, $3.50.
It is not required to align the fields as a nice-looking table.
3. Your program allows one customer purchasing multiple items. Also it will display an error
message if the product name entered by the user is not found in the product list or the quantity
is too high. If that occurs, the user will be given another chance, until an existing product or a
workable amount is entered.
Example:
Enter customer name: Joe
New customer!
Enter product name:
appl
Sorry, no such product. Try again.
Enter product name:
APPle
Enter quantity: 500
Sorry, not enough stock. Try again.
Enter quantity:
50
Joe purchased 50 x apple
Unit price: $3.5
Total price: $175
Continue?(Y/N)
4. The product list can be updated through a menu option. 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.
5. The above option will ask user to enter the prices for the new products 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 the operator enters a 5-
product list “
A B C D E”, then enters prices “1 2 3.5”. The latter is the price list, so A, B, C
are then set prices as $1, $2 and $3.5 respectively.

,
Page 5 of 8
A product may have no price, meaning a hidden product, not available to be sold, although it
exists in the program. Products D and E in the above example have no price.
Note a price of 0 is not the same as no price. $0 means the product is free and available.
6. For the new product list, the operator can add a list of stock, assuming the stock list always
matches with the product list, e.g. “
120 20 50 20 7” for product list “A B C D E”. If the stock
list was not entered, the quantity will be all zero for these products.
7. When a new customer made an order, this customer will be added to the customer list so the
same 10% discount will apply for all further purchases from this customer. You can assume
duplicate names never happen.
8. Your program displays all the existing customers, including the newly added customers.
9. Your program at this part can display all the products in the list on screen, with their prices and
stocks. Products with no price should be displayed as well. Below is an example of product
display.
A $1 120
B $2 20
C $3.5 50
D — 20
E — 7
10.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 may be challenging.
1. Followed Part 2, no price or price unknown are represented by a negative price. A product
with no price cannot be sold. This allows products to be entered into the system, but hidden.
An error message will show if the user attempts to order such products. If that happens, your
program should not quit but give user another chance to try other products.
2. A product may have a price of zero. That means a free product which can be given away to
customers. New customers cannot order any free product. Existing customers can at most
ask for two free items, e.g. a free teacup and a free spoon, or two free teacups.
This 2-item restriction applies on the entire lifecycle of a run. A new customer, named “Kiki”,
initially cannot order any free items. Kiki becomes an return customer after one order, and can
order 2 free items. So she did. After some other operations, e.g. making purchases for a
different customer, Kiki wants more free products. This new request can no longer be fulfilled.
3. Your menu has an option “
replenish in bulk” to set the stock of all products to a number
entered by the user. If the user entered 50, then every product will have 50 in stock.

,
Page 6 of 8
4. Your menu should have another option “replenish one” by which the operator can select a
product and then add a certain amount of new stock.
Example:

Enter product name:
appl
Sorry, no such product. Try again.
Enter product name:
APPle
Available stock: 20
Enter the amount to add:
0
Sorry, not a reasonable amount. Try again.
Enter the amount to add:
50
Stock of apple is now 70, press any key to go back.
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. This option displays the order
information as a table to show who ordered what, and marks the most valuable customer.
For example

P1 P2 P3 P4 Total
Linda 2 0 15 0 80.5
32
134.92 ** Most valuable
23.4
Jack 0 5 0 0
Zoran 10 0 0 1
Joe 3 2 1 0

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 ITP_A2_<Your Student ID>.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.

,
Page 7 of 8
You should consider more use of self-defined methods/functions to reduce code redundance and
complexity. You may notice that some of the functionalities are used in multiple places.
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
CanvasDiscussions’Assignment 2’ 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 ITP_A2_<Your Student ID>.py showing the final output of your program via
CanvasAssignmentsAssignment 2. 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.

,
Page 8 of 8
You are required to submit regularly, at least one submission per week unless you would like to
complete early.
Make one submission after completing each part. Canvas will keep all
submissions. No extension request will be granted if there is no sufficient amount of submissions.
Marking is purely based on the last version. Early submissions are only for progress management.
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 12 marks
Part 2 Functionalities 14 marks
Part 3 Functionalities 14 marks
Others
1. Code quality and style
2. Modularity / Use of methods
3. Comments / Analysis/ Reflection
– Up to 4 marks deduction for poor style
– Up to 4 marks deduction for poor modularity
– Up to 4 marks deduction for poor comments
and reflection