Codingassignmenthelper | Home Codingassignmenthelper | Samples

ITECH1400 - Assignment 1 – Container Recycling Machine

ITECH1400

Assignment 1

			Assignment Overview
You are tasked with creating a text-based program for simulating a Container Recycling Machine using the Python 3 programming language. 
The assignment is broken up into four main components: 
1.)	Design and model two classes: Container and Container_Recycling_Machine,

2.)	Create an activity chart which describes the behaviour of the Recycling Machine system, 

3.)	Create a computer program that allows a user to enter containers that are able to be recycled into a machine.  During the process the machine prompts the user for the type of container to be recycled and how many they have to enter. The machine keeps track of the number of each of the different containers and keeps track of the total amount to pay the user until they indicate that they are finished.  When they stop adding containers, print out a receipt and given them the amount of money owing. The receipt should contain the following:
a.	A list showing how many of each container has deposited and the cost of each container.
b.	The total amount provided for each container
c.	The total money received.

4.)	Finally, explain and integrate some code into your Recycling Machine program that keeps track of how many containers of each type are in the machine, and, if the machine is full, makes deposits of that container type unavailable. You machine should have at least 4 different products, and allow up to 50 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 (Container_Recycling_Machine.py, Container.py and main.py).
The main.py script runs the main logic of the program and will use instances of the Container_Recycling_Machine and Container classes to simulate depositing into a Recycling 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 recycle that you might want to be able to deposit into a Recycling Machine, like maybe an empty soft drink can. 
Start by listing all the properties of that object that you can think of – try to come up with at least ten general properties of a Container 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 Container class in the Word document template provided. Your Container 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 Container_Recycling_Machine class – think about what information the Recycling Machine has to keep track of to allow you to successfully deposit an container to be recycled. There will only really be three key properties that the Container_Recycling_Machine cares about, and the Container_Recycling_Machine class 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_product(),
3)	select_product()
4)	payout(anAmount)
5)	print_receipt().
Fill in the class diagram for the Container_Recycling_Machine class in the Word template, and that’s the first part completed!

Assignment Part 2 Details – Activity Flowchart
Using either the online website https://draw.io (preferred) or https://www.lucidchart.com, 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 may be familiar with how a Recycling Machine works, if not then you can always look online Recycling Machine.
Don’t worry about taking payment to debit or credit cards, our Container_Recycling_Machine will only provide cash.
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 Container 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 recyclable containers – 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. 

Example Program Output
Balance: $0.0. Please select a product: (Can, Bottle, Box, Stop): Can
How many cans do you have?: 3
Please place 3 cans into machine.
Can accepted
Can accepted
Can accepted
You added 3 can(s) for $0.20 each. You have $0.6.

Balance: $0.6. Please select a product: (Can, Bottle, Box, Stop): Bottle
How many bottles do you have?: 1
Please place 1 bottle into machine.
Bottle accepted
You added 1 can(s) for $0.50 each. You now have $1.10.

Please select a product: (Can, Bottle, Box, Stop): STOP

----- Final Receipt -----

3 Can(s)			$0.6
1 Bottle(s)		 	$1.0

Number of containers	4
Amount paid:		$1.6

Thank you for recycling at FedUni!

(N)ext customer, or (Q)uit? q
>>> 

Part 4 – Code Explanation and Use
You are provided with the following two functions which you should 
1.	Analyse to determine what they do & provide documentation comments for, and
2.	Incorporate into your final program solution. 
Wherever there is a # followed by some underscores in the code below, you should write a short comment explaining what the below section of code is doing, and if there is space why it is doing it. Do part 1 of the above in the provided assignment 1 template document, rather than here!


# First Function to: ___________________________
def get_int(prompt):

    # ____________________________________
    value = int(0)

    # ____________________________________
    while True:
        try:
            # ____________________________________
            value = int(input(prompt))

            # ____________________________________
            if value < 0:
                print("We don't accept a negative number of containers!")
                continue

            # ____________________________________
            break

        # ____________________________________
        except ValueError:
            print('Please enter a valid integer value.')

    # ____________________________________
    return value

# Second Function to: ___________________________
def accept_item(item_list):
    
    # ____________________________________
    item_list = []
    non_accepted_items = []
    MAX_WEIGHT = 15.0

    # ____________________________________
    for item in item_list:

        # ____________________________________
        if item.weight > MAX_BAG_WEIGHT:
            item_list.remove(item)
            non_accepted_items.append(item)

    # ____________________________________
    current_contents = []
    current_weight = 0.0

    # ____________________________________
    while len(item_list) > 0:

        # ____________________________________
        temp_item = item _list[0]
        item_list.remove(temp_item)

        # ____________________________________
        if current_weight + temp_item.weight < MAX_WEIGHT:            

            # ____________________________________
            current_contents.append(temp_item)
            current_weight += temp_item.weight
            
            # ____________________________________
            if (len(item_list) == 0):
                products_item.append(current_contents)
                
        # ____________________________________
        else:
            item_list.append(current_contents)

            # ____________________________________
            current_contents = []
            current_weight = 0.0

    # ____________________________________
    for index, bag in enumerate(machine_list):
        output = 'Machine ' + str(index + 1) + ' contains: '

        # ____________________________________
        for item in items:
            output += item.name + '\t'
        print(output, '\n')

    # ____________________________________
    if (len(non_accepted_items) > 0):
        output = 'Non-bagged items: '

        # ____________________________________
        for item in non_accepted_items:
            output += item + '\t'
        print(output,'\n')

Submission and Marking Process

You must supply your program source code files and your document containing the first two section of the assignment as a single compressed archive called:
with your own personal details! You may supply your word-processed documentation in either Microsoft Word or LibreOffice/OpenOffice formats only – no proprietary Mac specific formats, please.
Assignments will be marked on the basis of fulfilment of the requirements and the quality of the work. In addition to the marking criteria, marks may be deducted for failure to comply with the assignment requirements, including (but not limited to):
•	Incomplete implementation(s), and
•	Incomplete submissions (e.g. missing files), and
•	Poor spelling and grammar.

Submit your code and report through the “Assignment 1 Submission” folder.
The mark distribution for this assignment is explained on the next page – please look at it carefully and compare your submission to the marking guide.


Assignment 1 – FedUni Container Recycling Machine
Student name: 	Student ID: 
Part	Assessment Criteria	Weight	Mark
1a	Identification of properties of a typical item that can be recycled – Container.	10 * 0.5 = 5 marks	
1b	Application of abstraction to identify key properties of a typical Container as well as creation of a suitable Class Diagram.	4 marks	
1c	Identification of the key properties of a Container_Recycling_Machine as well as creation of a suitable Class Diagram which uses those properties, plus the four method signatures provided.	4 marks	
2	Creation of an activity flowchart which clearly indicates how the program should operate, using the correct symbols for elements such as start/end points, processes and decisions/branches	10 marks	
3	Programming of the Container Recycling Machine simulation so that it:
i)	Creates a small number of Container instances that may be accepted,
ii)	Accepts simulated ‘deposting’ of a Container after being identified from a list by the user,
iii)	Adds a Container to the Container_Recycling_Machine list of containers being purchased,
iv)	Allows the deposit of multiple containers,
v)	Provides ‘virtual money’ to pay for those products (you must pay enough to cover the cost of the items checked out), and
vi)	Prints a final receipt of the items deposited, along with the number of items and amount for each item, along with the total paid out.	4 + 4 + 4 + 4 + 4 + 4 = 24 marks.
	i)
ii)
iiI)
iv)
v)
vi)
Total:

4a	Analysis and documentation via code comments of the two functions provided.	(8 * 0.5) + (16 * 0.5) = 12 marks	
4b	Incorporation of the two functions provided into your main submission so that the program does not crash when an illegal money value is provided, and also virtually ‘bags up’ the products purchased.	2	
Overall	Overall code standard including comments, formatting, variable names	9	
	Assignment total (out of 70 marks)		
	Contribution to grade (out of 20 marks)		

			
			
			
To Download Click Here > ITECH1400_Assignment_1_2020.pdf
Codingassignmenthelper | Home Codingassignmenthelper | Home