Ask Python Expert

Assignment Overview

You are tasked with creating a text-based program for simulating a Vending Machineusing the Python 3 programming language.

The assignment is broken up into four main components:

1.) Design and model two classes:Productand VendingMachine,

2.) Create an activity chart which describes the behaviour of the vending machine system,

3.) Create acomputer program that allows a user to enter an amount of money, then interactively purchasea number of products until they either stop or the balance is zero. When they stop, print out a receipt. The receipt should contain the following:
a. A listshowing each item bought and the cost of each item.
b. The total money received.
c. The total spent.
d. Their change, if their balance was not completely spent.

4.) Finally, explain and integrate some code into your vending machine program that keeps track of how many products are available in the machine, and if an item is sold out, make it unavailable to the user. You machine should have at least 3 different products, and 2 of each product.

Your submission should consist of one document containing the first two parts of the assignment, and three Python scripts that implement the computer program (vendingmaching.py, product.py and main.py).
The main.py script runs the main logic of the program and will use instances of the VendingMachineand Product classes to simulate purchasing from a vending machine.

You are provided with a Microsoft Word template to help you complete the first two parts of this assignment.

Towards the end of this document you will also be provided with the output of a simulated run of the completed computer program which may help you with this assignment.


Assignment Part 1 Details - Class Design

Think of a product that you can buy from a vending machine, like maybe a can of soft drink or a bag of chips.
Start by listing all the properties of that object that you can think of - try to come up with at least tengeneral properties of a Product and write these down in your Assignment_Part_1_Microsoft Word document, provided for download in the assessment section of your Moodle shell.

Next, use the process of abstraction to cut the number of properties back to only ‘key' properties - write these down in the next section of your Word document.Take a look at the week 2 lecture slides if you need a reminder on how to go about this.

Now, fill in the class diagram for your Product class in the Word document template provided. Your product class does not have to have any methods (i.e. functions) associated with it to perform any actions other than a constructor which takes and set the key properties that you've identified.

Next we'll move on to VendingMachine class - think about what information the vending machine has to keep track of to allow you to successfully purchase a product. There will only really be three key properties that the VendingMachine cares about, and the VendingMachineclass should have the following five methods available:
1) A default constructor that takes no arguments and initialises a new object and its properties,
2) accept_money(),
3) select_product()
4) buy_product(some_product)
5) print_receipt().
Fill in the class diagram for the VendingMachine class in the Word template, and that's the first part completed!

Assignment Part 2 Details - Activity Flowchart

Using either the online website, or the applications Visio or Powerpoint - create an activity diagram of how the program should operate to successfully enter their money, buy one or more products, provide change and print a receipt for the user.

Make sure to use the correct symbols in your diagram for starting, processes, decisions/branches, and ending the process.

Although you should be familiar with how a vending machine works, if not then you can always go to a local vending machine (there are plenty on campus) buy your course coordinator a can of Coke-Cola (No Sugar please). - or take a look at a YouTube video of vending machine.

Don't worry about taking payment through debit or credit cards, our VendingMachine will only accept cash - although you can enter multiple denominations via a loop in theaccept_money(some_amount) method. For example, calling accept_money() will keep prompting the user to enter more money until they hit enter without giving a number.The customer must enter all their money before buying a product, they can't add to their balance once they have begun buying products.

Once you have completed your activity chart, add it to your assignment template document.

Assignment Part 3 Details - Software Implementation

You are free to implement the software however you see fit, however the functionality of the software should be able to match the following output. Note that in the below run of the program I have ‘hard-coded' a small number of Product instances so that products which exist can be purchased - in your code you should do the same.

Your program does not have to have the facility to add new products - just define a few and use them as demonstrated below. If the final option of STOP is chosen, the program should print the receipt and ask the user if they want to start again or quit.

Attachment:- Template.rar

Python, Programming

  • Category:- Python
  • Reference No.:- M93088319
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Python

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Assignment1 utilising python 3 build the following

Assignment 1. Utilising Python 3 Build the following regression models: - Decision Tree - Gradient Boosted Tree - Linear regression 2. Select a dataset (other than the example dataset given in section 3) and apply the De ...

Python programming assignment -you first need an abstract

Python Programming Assignment - You first need an abstract base class, called, Account which has the following attributes and methods: accountID: This attribute holds the ID assigned the account , if not provided set to ...

Learning outcomes lo3 - research develop and document a

Learning Outcomes LO3 - Research, develop, and document a basic security policy, and analyse, record, and resolve all security incidents LO4 - Identify and assess the threats to, and vulnerabilities of networks Assessmen ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Questionwhat is a python development frameworkgive 3

Question What is a python development framework? Give 3 examples python development framework used today. and explain which development framework is used in which industry.

Below zero - ice cream storethe local ice-cream store needs

Below Zero - ice cream store The local ice-cream store needs a new ordering system to improve customer service by streamlining the ordering process. The manager of the store has found that many orders are incorrect and s ...

The second task in this assignment is to create a python

The second task in this assignment is to create a Python program called pancakes.py that will determine the final order of a stack of pancakes after a series of flips.(PYTHON 3) Problem Task In this problem, your input w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As