The system, you are going to write, simulates a reverse vending machine. Such a machine is used to identify and collect used beverage containers for recycling or reuse from customers, who in return receive a monetary refund. When you use the system, you enter different cans and bottles into the machine, and when you are finished, you ?press a button? to get a refund ticket.
In the first iteration we assume that there are three different types of bottles or cans:
Deposit A: Cans and bottles less than 1 litre DKK 1,00
Deposit B: Exception. Bottles of plastics 0,5 litre DKK 1,50
Deposit C: Cans and bottles on or more than 1 litre DKK 3,00
The recycling machine has to be implemented in two classes: ReturnItem and ReturnMachine.
The cans and bottles are implemented in the class Container. Unless it is mentioned in the description below, you decide the names of the fields, parameters, variables and the methods, but it is important that the names you choose are appropriate.
The ReturnItem class should have the following characteristics:
A character field storing the type of return item, e.g. ?A?, ?B? or ?C?
A character field storing a text describing the return item
An integer field storing the deposit value in ?Ýre?
An integer field storing the number of items returned for this type of item
A constructor having three parameters, initialising the two text fields and the deposit value field. The last field should also be initialised.
Accessor methods: Four different methods returning each of the fields
A method toString() that returns a String object as a concatenation of all the fields in a readable form
A method that increments the number of returned items when its type of return item is entered into the machine
A method setting the deposit value to the value passed as a parameter. The parameter value has to be checked, so it is positive and payable in coins (it has to be dividable by 50)
A method that resets this type of return item, e.g. the number of items returned is set to 0