In: Computer Science
Think of a product that you can recycle that you might want to be able to deposit into aRecycling 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 tengeneral properties of aRecyclableItemand 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 Item class in the Word document template provided. Your RecyclableItemclass 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 RecyclingMachine class – think about what information the Recycling Machine has to keep track of to allow you to successfully deposit an item to be recycled. There will only really be three key properties that the RecyclingMachine cares about, and the RecyclingMachineclass 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 RecyclingMachine class in the Word template, and that’s the first part completed!
The class diagram for Recycling Machine and Recycle products are as follows -
properties of recycling products are -
properties which is used for abstraction is -
The class diagram for Recycling Machine and Recycling Products are -
The class Recycling Machine is used as a abstract class which can use recyclable and non-recyclable material,which can be identified by the method (function) accept_product(), then the process goes to select_product() which can do the recycling process,before doing this process payout(Amount). The payment will be done from the user side to start the process.Finally the receipt will be printed for the recycled item.