Design and model two classesproductand vendingmachine -


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:- Assignment__Vending_Machine.rar

Solution Preview :

Prepared by a verified Expert
Python Programming: Design and model two classesproductand vendingmachine -
Reference No:- TGS02910911

Now Priced at $40 (50% Discount)

Recommended (99%)

Rated (4.3/5)