Msc the Vending Machine

Only available on StudyMode
  • Download(s) : 698
  • Published : November 8, 2010
Open Document
Text Preview
The Vending Machine
This program is intended to set up and then simulate control of the functions of a vending machine.

1)A class Diagram to represent the associations between classes. You can use Visio, MS Word or manual drawing to produce the Class Diagram.

2)A brief description of how Program Development fits into the system development life CYCLE First of all, I designed the needed class definitions and design my objects. Then I decided the interactions between my class models. The other important part is this. In this part, I choose the connection ad communication cycles between my class model., I mean which class “uses” another class or reference another class, or helping other class with its capabilities. My main basic functional data types are Product and VendingProduct classes. These are basic classes used by others. The start of the program is the Driver class which included Main method. Then ProductOperationModule is used as a bridge , making operations of main and calling and generating data and object array. And this class also calls the GUI at the end. 3)A brief description of how the JPanel and JButton Classes are implemented in your program For screen design I used BorderLayout and GridLayout, seeing the frame like grids. I need two separate part in the screen, one is for texbox for total, payment, replenish and exit buttons ; and the other part is for Product buttons in vending machine. So in JFrame, I defined two JPanel for them. for total, payment, replenish and exit buttons is one panel, and buttons are in other panel. this.setLayout(new BorderLayout());

this.add(p1, BorderLayout.NORTH);
this.add(p2, BorderLayout.CENTER);
As seen above, p1 and p2 panels are designed with p1 is north means upper of the frame, and p2 is center means below of it. For product buttons;
JButton btn[] = new JButton[10];
Designed array of JButtons,
for (int i = 0; i < btn.length; i++) {
btn[i] = new JButton();...
tracking img