代写EMATM0048 Software Development: Programming and Algorithms (SDPA) 2023/24代做Python语言

- 首页 >> CS

MSc in Data Science 2023/24, EMATM0048

Software Development: Programming and Algorithms (SDPA)

Resit Coursework Assessment (100%)

This unit assessment asks you to apply the skills and tools that you’ve learned throughout the unit, on a selection of different tasks. General guidelines areas follows:

•    Deadline: 13:00 (UK time) on Friday 2nd  August 2024.

•    Rules: Don't share your code with anybody. You are welcome to discuss questions with other students, but don't share the answers. The experience of solving the problems in this project will prepare you for real problems in data science (and life).

•   Support: You are not alone. If you're ever feeling overwhelmed or don't know how to make progress, email the teaching team/unit director for help.

•   Academic Integrity: Academic misconduct (for example, plagiarism, collusion, contract cheating) is unacceptable and will be dealt within accordance with university policies. Please note that submitting artificial intelligence answers as your own is a form of contract           cheating.           More           information           is           available           here:

https://www.bristol.ac.uk/students/support/academic-advice/academic-integrity/

•   Advice: Develop your answers incrementally. To perform a complicated task, break it up into steps, perform each step on a different line, give a new name to each result, and check that each intermediate result is what you expect.

Coursework general instructions:

Code commenting and documentation

Your code must be documented appropriately using docstring comments. Document as you go, not all at the end. One strategy is to write a brief comment about the “one thing” that the function  is  supposed  to  do  when  you  declare  it,  then  refer  to  that  comment  while implementing it: this helps maintain focus when implementing the function and helps stop yourself from making it do more than the ‘one’ thing it is supposed to do. Each class and each method should have at least one docstring which can be brief.

For this project you will need to create a readme.md text file in your ~/project folder that explains each part of the project. Specifications are below:

•    Part  1:  readme.me  file  should  include  a  description  of  your  code  design,  classes, methods,  and  other   key  details.  Your  readme.md  file  should  be  at   least  several paragraphs in length and should explain what your project is, what each of the files you wrote for the project contains and does, and if you debated certain design choices, explain why you made them. Ensure you allocate sufficient time and energy to writing a readme.md that documents your code thoroughly.

•    Part 2: Documentation for part 2 is in Jupyter notebook using markdown cells. Any additional  libraries,  external  sources   needed  to  run  the  code  correctly   must   be explained in the readme.md file.

If  you  are  unfamiliar  with  Markdown  syntax,  you  might  find  GitHub’s  Basic  Writing  and Formatting Syntax helpful:

https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/basic- writing-and-formatting-syntax

Version Control

You must use version control to keep track of your progress during implementation, using Git.

You should perform regular commits as you implement features and fix errors. Your commit comments should reflect the context of the changes that were made in each commit—a fellow developer can always diff the contents to see exactly what changed but that does not provide the context. You should try to ensure each commit comment contains a short subject line. Ensure that the repository is private, i.e., cannot be seen by people other than yourself. Failure to do that will be considered plagiarism. If version control is not submitted or made public, 10 pts will be deducted.

Submitting your coursework

Your submission will comprise your entire version control repository for the three parts. Your repository must contain all source files required to run your program.

Your submission must include your code for each part: part 1 and part 2.

•    Part 1: Includes different Python scripts to run your code.

•    Part 2: Jupyter Notebook file that includes code and explanation in the markdown for each step. The collected data saved inStep 1 must be submitted too.

•   GitHub markdown (readme.md file): to explain any required instructions for running your code (please refer to “code documentation and commenting section”).

•    If you have used any additional code for part 2, beyond standard Python packages,

then you will need to include an additional subdirectory containing additional code

required to run your scripts. The authorship of any such code should be clearly stated in the GitHub markdown (readme.md).

o Note: A link of GitHub repository must be included in your readme.md file.

For  submitting  your  work  on  Blackboard,  you  will  need to submit  a  zip  file  and  GitHub Repository  with  the  name  (“UOBusername_EMATM0048).  Your  zip  file/repository  should contain the latest version of your GitHub repository. You will need to add "SDPA-UoB" as a collaborator to your repository. Please note you must NOT change your remote repository once you added SDPA-UoB as a collaborator.

Grading

Your grade will be assessed on both correctness and style.

•   Correctness: How well the program works according to specifications. How good is the quality of your analysis.

•   Style: The quality of the code and documentation.

Your code should be well-written and well-commented. You are encouraged to format your code per Python style. guidelines (https://www.python.org/dev/peps/pep-0008/). It should be clear enough for another programmer, such as the course staff, to understand and modify it if needed. Quality code is expected to meet our style requirements:

•    Every function written is commented, in your own words, using a docstring format that describes its behaviour, parameters, returns, and highlights any special cases.

•   There is a comment at the top of each code file you write with your name, section, and a brief description of what that program does.

Part 1: Software Development (50%)

This part will require you to design, implement, test, and debug a text-based coffee shop simulation.    You   must   use   an  object-oriented  approach  with  appropriate  relationships between classes.

This simulation must be text-based and will not have a graphical user interface; hence it is not allowed to use turtle, pygame, tkinter or any other API or external library for implementation. Only python standard libraries can be used in Part 1 https://docs.python.org/3/library/

Background

A coffee shop has coffee types that customers can purchase.  The coffee shop needs to have baristas to make the coffee. It also needs to have milk, beans, and spices as ingredients that it purchases from a supplier. Each month the  coffee shop owner must decide whether to add/remove baristas, how much coffee to sell for each type, and then pay expenses.  The goal of the coffee shop is to make a profit and avoid going bankrupt.

Task overview

In this part,you are required to write a text-based (no GUI is required) Python program using object-oriented programming to simulate the monthly actions of the shop owner. Your program should do the following:

A.   The shop sells the following types requiring the specified amount of ingredients

Coffee Types              Milk                  Beans             Spices                  Time   to    Prepare

(in minutes)

Expresso

0.0

8g

0g

1.0

Americano

0.0

6g

0g

1.0

Filter

0.0

4g

0g

0.5

Macchiatto

100ml

8g

2g

3.5

Flat White

200ml

8g

1g

4.0

Latte

300ml

8g

3g

3.0

The following table shows the maximum quantity that the shop’s pantry can store in any given month. The table shows the loses that occur each month due to depreciation (e.g. milk going bad, we assume spices do not go bad).  When determining the quantity to depreciate, be sure to take the ceiling (i.e. round up to nearest integer).  The table also shows the pantry costs per month.   For example, if the shop has 300 litres that did not get used during the month, only 180 litres will be available for the next month and the shop will have incurred pantry costs of £30.

Ingredient             Max Quantity           Depreciation          Pantry costs

Milk

300 litres

0.4/month

£0.10 / litre

Beans

20000g

0.1/month

£0.001 / g

Spices

4000g

0.1/month

£0.001 / g

The shop pays a fixed monthly rent of £2,500 and keeps a monthly amount of cash. The shop starts with a cash balance of £10,000.

B.   Regardless of  how  much demand there is, each barista gets paid for 120 hours and provides 80 hours of coffee making labour per month.   Each barista has a name and works at a fixed rate of 15 pounds per hour.  You can only add/remove baristas each month (i.e. even if there is no demand, you must pay baristas for the entire month). Based on the confines of the shop, the maximum number of baristas that can be added is 4.  Due to local business requirements, the shop must employ at least one barista. Assume the owner requires no salary and cannot serve coffee.

C.   There is one supplier that sells the ingredients as follows. Assume the supplier can deliver the ingredients immediately and that there is no limit to the amount than can be purchased from the supplier.

Supplier Name                 Milk                   Beans            Spices

Hasty

£0.30/litre

£0.10/g

£0.05/g

D.  The customer demand by coffee type per month is shown in the following table.

Coffee Types                        Monthly Demand                                    Sell Price

Expresso

500

£2.0

Americano

200

£3.0

Filter

300

£2.0

Macchiatto

400

£3.5

Flat White

600

£4.0

Latte

1000

£4.5

E.   At the beginning of the program, prompt the user to enter the number of months to run the simulation.  Default will be to run the simulation for six months.  Assume the shop’s pantry is full when the simulation starts.

F.   Allow  the  owner  to choose  how  many  baristas to  add/remove and the amount of coffee to sell for each coffee type (these must be positive integers) .  When removing an  employee,  you  are  free  to  decide  which  employee  is  removed  but  be  sure  to

indicate which one was removed. G.   For each month:

a.   Prompt the owner to add/remove baristas for beginning of the month.

b.   Prompt the owner for  how  much of each coffee type to sell, ensuring that it does not exceed the demand, ingredient, and labour constraints.

c.   Given these decisions, assume the  month  runs  accordingly.   Based on  how much was sold, update the shop’scash.


d.   Pay the baristas from cash. 

e.   Pay pantry costs from cash.

f.    Display the status of the shop to include the  number of baristas, the baristas names (any specialities), and number of shop ingredients in the pantry.

g.   Apply the depreciation to the pantry.

h.   Purchase ingredients from the supplier so that the pantry is fully replenished.

i.     If there  is  not  enough  cash  on  hand  to  pay  expenses,  then  the  shop  goes bankrupt and the simulation ends.

The simulation terminates after the months specified, or the shop goes bankrupt.

Task specifications

•   Create your classes (15%)

Your program should have at least three classes, in their own file, to include:

CoffeeShop  class  contains  attributes  and  associated  functions   about  the ingredients, cash status, and number of baristas.

•    Run your code (15%)

Create the main script (main.py) to run the classes you implemented. The main script must not define any classes.  The classes should be imported into the main script. All constraints must be met. The simulation ends when the maximum number of months or the shop goes bankrupt.

•    Extend your program (20%)

Make sure the basic requirements are implemented correctly before extending your program.   Modify your  program so that  a barista can be specialised in making one coffee type.  They can still make other coffee types, but they can make the specialised coffee in 1/2 the time.  When hiring a barista, prompt for whether the barista has a specialty, and if so, prompt for the coffee type they specialise in.   Update so that the coffee demand and barista specialty is considered when meeting customer demand. Demand for  a  coffee  type  is  first  met  by  specialised  baristas  followed  by  regular baristas.

•    Bonus question (+4%) Optional

Create an owner class that will run the simulation automatically making decisions for each  month.  The  owner  must  make  decisions  based  on  the  current  state  of  the simulation (i.e. you cannot simply make the same decision each month) .

•    Errors and exceptions handling (included in the grading for each step)

Since you are taking user input, your code will need to handle potential errors.   Most errors occur in Null values and non-integer inputs. Make sure you handle these errors. Your program should continue to run when given invalid input.   Examples of errors to be handled:

o No input

o Non-integer or positive input

o A barista already exists


站长地图