Lukket

Drinks Machine - Java Code

Project Outline This assignment centres around developing code to model the behaviour of a machine which dispenses cans of soft drinks. The machine can dispense 4 different kinds of cans (type1,type2,type3,type4). The cost of each type of may be independently set. Suggested prices are 40,45,45 and 50 pence respectively. Two of the dispensers for the cans hold 25 cans each and the other two hold 30 cans each. The machine accepts an amount of money in the form of coins up to the value of £2 from the user and checks that the amount entered is sufficient to pay for the can selected. If the user supplied an excess of money then the amount of change returned is displayed. Appropriate error/information messages are generated as a result of the incorrect/excess amount of money being entered. The drinks machine maintains a count of the total number of cans dispensed and the total cost of the cans dispensed. The drinks machine is initialised with an appropriate number of cans of each type. The drinks machine must provide an appropriate error message if there are insufficient cans of the required type. The drinks machine can also be re-filled with an appropriate number of cans of the appropriate type. If there are surplus cans of a particular type after an attempt to fill an individual dispenser, then the person filling the machine is informed of the surplus. The DrinksMachine is initialised each time the program in which the DrinksMachine object is declared is run. There is therefore scope to load and save the state of the DrinksMachine each time your program is run.

## Deliverables

Part 1 You are therefore required to design, code and test a class called DrinksMachine which models the behaviour outlined above. The class DrinksMachine should exhibit the following behaviour : • Can be initialised with an appropriate number of cans of each type • Can be initialised with individual prices for each type of can • Can deliver a can of the selected type in response to a sufficient amount of money being entered • Indicates the amount of change returned • Can be filled with an appropriate number of cans of the required type • Can display the current number of cans available of each type • Maintains a count of the total number of cans dispensed • Maintains the total cost of the cans dispensed • Saves and loads the state of the drinks machine between each run of the program. You will need to produce a class to test the class DrinksMachine. You must call this class DMTest.java. The class DMTest will contain the method main. This class should provide a simple command line interface in the style of the Robot example used in the Java Classes Notes to allow you to test each of the methods in the DrinksMachine class. For part 1 you are required to submit • A design in the form of pseudo code for each method in the class DrinksMachine • A UML class diagram for the DrinksMachine class • A printed copy of the Java source code for [url removed, login to view] and [url removed, login to view] • A test strategy outlining why you chose your test data and what situations you are testing. • Sample output showing the result of running the program DMTest having initialised the DrinksMachine object with the maximum number of cans and then dispensing at least two cans of each type. • A floppy disk containing [url removed, login to view], [url removed, login to view], [url removed, login to view] and [url removed, login to view] along with any data files used to maintain program state between runs. These files must be contained in a subdirectory called part1. Part 2 This part of the assignment requires you to build a Graphical User Interface (GUI) called DMGui for the DrinksMachine class and to link it to an instance of the class DrinksMachine. The GUI should provide the following facilities : • the ability to select a particular type of drink • a visual representation of the number of cans of each type available • the ability to enter an amount of money to pay for a can • the ability to fill the drinks machine with an appropriate number of cans • a warning when the number of cans falls below 10% of maximum capacity • suitable error messages if too many cans are added • display a count of the total number of cans dispensed • displays the total cost of the cans dispensed • allows the previous state of the machine to be loaded • allow the current state of the machine to be saved You will need to construct a class called [url removed, login to view] to test the DMGui class in conjunction with a DrinksMachine instance. The class DMGuiTest will contain the method main. For part 2 you are required to submit • a design in the form of pseudo code for each method in the class DMGui • a UML class diagram for DMGui (and DrinksMachine if there were any changes made form Part 1) • a printed copy of the java source code for [url removed, login to view], [url removed, login to view] and [url removed, login to view] (highlighting any changes to the class DrinksMachine from what was used in part 1) • a test strategy outlining why you chose your test data and what situations you are testing • Sample output showing the result of running the program DMGuiTest having initialised the DrinksMachine object with the maximum number of cans and dispensing at least 2 cans of each type • a floppy disk containing [url removed, login to view], [url removed, login to view], [url removed, login to view], [url removed, login to view], [url removed, login to view] and DrinksMachine.class. The files must be held in a subdiretcory called part2

## Platform

Windows 2000

Evner: Ingeniørarbejde, Java, MySQL, PHP, Software Arkitektur, Software Testning

Se mere: what is uml design, up part1, uml diagram with example, state coins value, method models, graphical diagram, code line, code for money, class diagram user, assignment method example, 3 line diagram, project object model, uml and java code, pseudo code, machine design, java to c, java code, java and php, build a java program, assignment java

Om arbejdsgiveren:
( 1 bedømmelse ) United Kingdom

Projekt ID: #2933199

1 freelancer byder i gennemsnit $21 på dette job

childode90s

See private message.

$21.25 USD in 14 dage
(1 bedømmelse)
0.5