You are on page 1of 70

LAB CODE: CS2357 <Activity> 2Bank Account <State>Car Person Object Truck Object 1 Vehicle Object 1 Object 2 Bus

NAME: OBJECT ORIENTED ANALYSIS AND DESIGN LABORAT


1. P A R I VA K K A M

CHENNAI 600 056

NAME

REGISTER NUMBER:

YEAR/SEMESTER BRANCH

: :

Third Year / Sixth Semester


B.E. COMPUTER SCIENCE

2. P A R I VA K K A M

CHENNAI-600056

REGISTER NUMBER BONAFIDE CERTIFICATE

Certified that this is a Bonafide Record of the work done by


--------------------------------------------------------------------------------

Third Year(Sixth

Semester)

of CSE

Department in the Object Oriented Analysis and Design Laboratory (CS2357) during academic year 2011- 2012. Signature of the Staff HOD Submitted for the Practical Examination held on --------------------------------------E te a E a in r x rn l x m e In rn l E a in r te a x m e

Signature of

INDEX

S.No
1.

Date

Name Of The Experiment


STUDY OF UML NOTATIONS COURSE REGISTRATION SYSTEM AIRLINE TICKET RESERVATION SYSTEM STOCK MAINTENANCE SYSTEM

Page No

Staff Sign

2.

3.

4.

5 6 7

RECRUITMENT SYSTEM LIBRARY MANAGEMENT SYSTEM CONFERENCE MANAGEMENT SYSTEM

EX.NO:1

STUDY OF UML

AIM
To study the basic concepts of Unified Modeling Language.

UML NOTATION
Unified Modeling Language. Set of notations and conventions used to describe and model an application. Universal language for modeling systems. Standard notation for OO modeling systems. Does not specify methodology to develop an application.

UML DIAGRAMS
1. Class Diagram 2. Use Case Diagram 3. Behavioral Diagram 3.1. Interaction Diagram 3.2. Sequence Diagram 3.3. Collaboration Diagram 3.4. State Chart Diagram 3.5. Activity Diagram 3.6. Implementation Diagram 3.6.1. Component Diagram 3.6.2. Deployment Diagram

CLASS DIAGRAM
Shows the static structure of the model. Collection of static modeling elements such as classes and their relationships Connected as a graph. Provides visual representation of objects, relationships and their structures. CLASS A class is a set of objects that share a common structure and common behavior. It is represented as:

<CLASS NAME> <ATTRIBUTES> <OPERATIONS> INTERFACE Specifies the externally-visible operations of a class and/or component.

ASSOCIATION Model properties of associations. The properties are stored in a class and linked to the association relationship. Example,

GENERALIZATION A generalize relationship is a relationship between a more general class or use case and a more specific class or use case. Example,

USE CASE DIAGRAM


Set of use cases enclosed by system boundary, communication association between actors and use cases, and generalization among use cases.

ACTORS External factors that interacts with the system from the user's perspective.

USE CASES Set of scenarios that describe how actor uses the system. Represented as

RELATIONSHIP Communication communications with the use case normally. Uses Shown by generalization arrow from the use cases. Extends Used when one case does more than another that is similar to it.

BEHAVIOR DIAGRAM
INTERACTION DIAGRAM Diagrams that describes how group of objects are collaborated.

SEQUENCE DIAGRAM:
Describes the behavior of the system through interaction between the system and the environment in time sequence. Two dimensions: Vertical dimension represents time. Horizontal dimension represents objects. Life line Object's existence during the interaction.

<EVENT>

COLLABORATION DIAGRAM:
An interaction diagram that shows the order of messages that implement an operation or a transaction. Collaboration diagrams show objects, their links, and their messages.

<EVENT> Object: An object has state, behavior, and identity. Objects interact through their links to other objects. Link: A link is an instance of an association, analogous to an object. Message: A message is the communication carried between two objects that trigger an event.

STATECHART DIAGRAM
Models the dynamic behavior of individual classes or any other kind of object. Shows the sequences of states, events, and actions. State: Represents a condition or situation during the life of an object during which it satisfies some condition or waits for some event.

Start State: Shows the beginning of workflow.

End state:: Represents the final or terminal state.

ACTIVITY DIAGRAM
Used for modeling the sequence of activities in a process Special case of a state machine in which most of the states are activities and most of the transitions are implicitly triggered by completion of the actions in the source activities.

Activity: Represents the performance of task or duty in a workflow.

Swim lanes: Represents organizational units or roles within a business model.

IMPLEMENTATION DIAGRAM
Shows the implementation phase of system development. Two types of implementation diagrams: Component diagram Deployment diagram

COMPONENT DIAGRAM
Models the physical components in the design. A graph of the designs components connected by dependency relationships. Includes concept of packages. Package is used to show how classes are grouped together.

DEPLOYMENT DIAGRAM
Shows the configuration of runtime processing elements and software components. It is a graph of nodes connected by communication association. Nodes are the components that are connected to other components through dependencies. Used in conjunction with component diagrams to show the distribution of physical modules.

RESULT:Thus the different conceptual models under UML have been studied.

AIM To analyze, design and develop code for Course registration system using Argo-uml EX.NO:2

COURSE REGISTRATION SYSTEM


PROBLEM STATEMENT
At the beginning of each semester students may request a course catalogue containing a list of course offerings for the semester. Information about each course, such as professor, department, and prerequisites will be included to help students make informed decisions. The new on-line registration system will allow students to select four course offerings for the coming semester. In addition, each student will indicate two alternative choices in case a course offering becomes filled or canceled. No course offering will have more than ten students. No course offering will have fewer than three students. A course offering with fewer than three students will be canceled. Once the registration process is completed for a student, the registration system sends information to the billing system, so the student can be billed for the semester. This system is designed in such a way that Professors must be able to access the on-line system to indicate which courses they will be teaching. They will also need to see which students signed up for their course offering. For each semester, there is a period of time that students can change their schedules. Students must be able to access the on-line system during this time to add or drop courses. The billing system will credit all students for courses dropped during this period of time.

Modular Description MODULE 1 Provide a user interface for getting the users login details. Verify login ID and if correct, allow the student to register. MODULE 2 Get Students Register number and College Details. Allow the student to choose Core subjects and Electives. MODULE 3 Get all the necessary details in the registration form. On successful registration show Success Message.

UML DIAGRAMS: USECASE DIAGRAM:

CLASS DIAGRAM:

SEQUENCE DIAGRAM:

ACTIVITY DIAGRAM:

CODING: LoginForm.java

import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; class LoginForm extends JFrame implements ActionListener { JTextField t1; JPasswordField t2; public LoginForm() { Font f1=new Font("Courier",Font.BOLD,38); Font f2=new Font("Courier",Font.BOLD,18); setLayout(null); JLabel l1=new JLabel("COMPUTER SCIENCE DEPARTMENT"); JLabel l2=new JLabel("(ELECTIVE SUBJECT SELECTION FORM)"); l1.setFont(f1); l2.setFont(f2); l1.setForeground(Color.RED); l2.setForeground(Color.RED); add(l1).setBounds(160,10,800,50); add(l2).setBounds(260,40,800,50); JLabel t1=new JLabel t2=new l3=new JLabel("Enter Login Name"); JTextField(20); l4=new JLabel("Enter Password"); JPasswordField(20);

add(l3).setBounds(350,200,200,20); add(l4).setBounds(350,230,200,20); add(t1).setBounds(490,200,150,20); add(t2).setBounds(490,230,150,20); JButton b1=new JButton("Enter"); JButton b2=new JButton("Exit"); add(b1).setBounds(400,270,80,20); add(b2).setBounds(500,270,80,20); b1.addActionListener(this); b2.addActionListener(this); setSize(1000,650); setVisible(true); setResizable(true); setTitle("ELECTIVE SUBJECT SELECTION FORM"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Enter")) {

String username=t1.getText(); String password=t2.getText(); if(username.equals("user") && password.equals("admin")) { RegistrationForm rf=new RegistrationForm(); //rf.setResizable(false); } else { JOptionPane.showMessageDialog(this,"Enter correct username & password"); t1.setText(""); t2.setText(""); } } else if(str.equals("Exit")) { System.exit(0); } } public static void main(String args[]) { LoginForm form=new LoginForm(); } }

RegistrationForm.java import import import import java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

public class RegistrationForm extends JFrame implements ActionListener { public RegistrationForm() { Container c=getContentPane(); c.setLayout(new GridLayout(7,1)); JPanel p1=new JPanel(); JLabel title=new JLabel("Enter the following details"); title.setFont(new Font("TimesNewRoman",Font.BOLD,30)); title.setForeground(Color.BLUE); p1.add(title); c.add(title); JPanel p2=new JPanel(); JLabel l1=new JLabel("Enter University Number:"); l1.setFont(new Font("TimesNewRoman",Font.BOLD,16)); JTextField t1=new JTextField(20); p2.add(l1); p2.add(t1); c.add(p2); JPanel p3=new JPanel(); JLabel l2=new JLabel("Enter student name:"); l2.setFont(new Font("TimesNewRoman",Font.BOLD,16)); JTextField t2=new JTextField(20); p3.add(l2); p3.add(t2); c.add(p3); JPanel p4=new JPanel(); JLabel l3=new JLabel("Select main subject:"); l1.setFont(new Font("TimesNewRoman",Font.BOLD,16)); JCheckBox c1=new JCheckBox("Java"); JCheckBox c2=new JCheckBox("OOAD"); JCheckBox c3=new JCheckBox("Data Structures"); JCheckBox c4=new JCheckBox("Networks"); JCheckBox d9=new JCheckBox("TOC"); p4.add(l3); p4.add(c1); p4.add(c2); p4.add(c3); p4.add(c4);

p4.add(d9); c.add(p4); JPanel p5=new JPanel(); JLabel e1=new JLabel("Elective-I:"); e1.setFont(new Font("TimesNewRoman",Font.BOLD,16)); JRadioButton c5=new JRadioButton("Micro Processor"); JRadioButton c6=new JRadioButton("DSP"); JRadioButton c7=new JRadioButton("Web Graphics"); JRadioButton d7=new JRadioButton("PCD"); ButtonGroup bg1=new ButtonGroup(); bg1.add(c5); bg1.add(c6); bg1.add(c7); bg1.add(d7); p5.add(e1); p5.add(c5); p5.add(c6); p5.add(c7); p5.add(d7); c.add(p5); JPanel p6=new JPanel(); JLabel e2=new JLabel("Elective-II:"); e2.setFont(new Font("TimesNewRoman",Font.BOLD,16)); JRadioButton c8=new JRadioButton("Data Mining"); JRadioButton c9=new JRadioButton("Numerical Methods"); JRadioButton c10=new JRadioButton("Embedded Systems"); ButtonGroup bg2=new ButtonGroup(); bg2.add(c8); bg2.add(c9); bg2.add(c10); p6.add(e2); p6.add(c8); p6.add(c9); p6.add(c10); c.add(p6); JPanel p7=new JPanel(); JButton b1=new JButton("Submit"); JButton b2=new JButton("Exit"); p7.add(b1); p7.add(b2); c.add(p7); b1.addActionListener(this); b2.addActionListener(this); setSize(1000,650);

setVisible(true); setResizable(true); setTitle("ELECTIVE SUBJECT SELECTION FORM"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Submit")) { SuccessMessage sm=new SuccessMessage(); sm.setSize(1000,650); sm.setVisible(true); } else if(str.equals("Exit")) { System.exit(0); } } }

SuccessMessage.java
import import import import javax.swing.*; java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener;

class SuccessMessage extends JFrame implements ActionListener { public SuccessMessage() { setLayout(null); JLabel l1=new JLabel("ELECTIVE SELECTION FORM SUBMITTED SUCCESSFULLY"); l1.setBounds(50,50,1200,100); l1.setForeground(Color.GREEN); l1.setFont(new Font("TimesNewRoman",Font.BOLD,28)); add(l1); JButton b1=new JButton("Exit"); add(b1).setBounds(400,175,150,25); b1.addActionListener(this); setSize(1000,1000); setVisible(true); setResizable(true); setTitle("ELECTIVE SUBJECT SELECTION FORM");

} public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Exit")) { System.exit(0); } } }

Output: LoginForm:

RegistrationForm:

SuccessMessage:

EX.NO:3

AIRLINE RESERVATION SYSTEM

AIM : To analyze, design and develop code for air line reservation system using Argo-uml PROBLEM STATEMENT An airline reservation system migration is one of the more complex, time intensive and costly undertakings for airlines today. The challenge lies in finding the right balance between doing it expeditiously and successfully mitigating risks while handling the monumental logistical challenges of maintaining airline operations during the migration. A management system for a transportation carrier such as an airline is described that provides network-based management of customer data by allowing a user to form a list comprising multiple customers associated with different sets of criteria and to process customer data corresponding to customers associated with multiple lists defined by different criteria. In one embodiment, an airline management system allows a user to append additional customers to a list comprising previously selected customers without having to re-request the list with additional search criteria and re-select the previously selected customers. The airline management system also allows a user to simultaneously display multiple lists of customers that are defined by different criteria. As a result, airline personnel using the airline management system may more effectively and efficiently access and manage customer data required to provide airline services.In today's competitive market it's imperative that we offer our customers the same functionality and service online as we would in the traditional ticket sales process.

Modular Description Reservation Module: This module allows the user to reserve tickets for a particular flight on a particular date if there is a vacancy. MODULE 1 3. Before entering the system, users have to login

Get the username and password from existing users. Validate the login details and allow user to ticket reservation form. MODULE 2 Get the source and destination. Provide a dropdown box for the date. Get the departure and arrival time from the user. Check availability of tickets.

Ticket Confirmation module : MODULE 3 If tickets are available, get the number of passengers. Get the name, gender, number of passengers. If tickets are not available, reschedule. MODULE 4 Print the cost of the tickets. Confirm the details and save the ticket. Display confirmed ticket to the user. UML DIAGRAMS: USECASE DIAGRAM:

CLASS DIAGRAM:

SEQUENCE DIAGRAM:

ACTIVITY DIAGRAM:

STATE CHART DIAGRAM:

COMPONENT DIAGRAM:

CODING: LoginForm.java
import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; class LoginForm extends JFrame implements ActionListener { JTextField t1; JPasswordField t2; public LoginForm() { Font f1=new Font("Courier",Font.BOLD,38); Font f2=new Font("Courier",Font.BOLD,18); setLayout(null); JLabel l1=new JLabel("Airport Authority of India"); JLabel l2=new JLabel("(Ticket Reservation System)"); l1.setFont(f1); l2.setFont(f2); l1.setForeground(Color.MAGENTA); l2.setForeground(Color.MAGENTA); add(l1).setBounds(220,10,800,50);

add(l2).setBounds(350,40,800,50); JLabel t1=new JLabel t2=new l3=new JLabel("Enter Login Name"); JTextField(20); l4=new JLabel("Enter Password"); JPasswordField(20);

add(l3).setBounds(350,200,200,20); add(l4).setBounds(350,230,200,20); add(t1).setBounds(480,200,150,20); add(t2).setBounds(480,230,150,20); JButton b1=new JButton("Login"); JButton b2=new JButton("Exit"); add(b1).setBounds(400,270,80,20); add(b2).setBounds(500,270,80,20); b1.addActionListener(this); b2.addActionListener(this); setSize(1000,750); setVisible(true); setResizable(true); setTitle("Airline Ticket Reservation System"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Login")) { String username=t1.getText(); String password=t2.getText(); if(username.equals("user") && password.equals("admin")) { Reservation rf=new Reservation(); } else { JOptionPane.showMessageDialog(this,"Enter correct username & password"); t1.setText(""); t2.setText(""); } } else if(str.equals("Exit")) { System.exit(0); } } public static void main(String arg[]) { LoginForm form =new LoginForm();

} }

Reservation.java
import import import import import java.io.*; java.util.*; java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener;

import javax.swing.*; public class Reservation extends JFrame implements ActionListener { private JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9; private JTextField firstname, lastname, seats, fare; private JComboBox source, dest, day, month, year, company, arr,dept,atim,dtim; private JRadioButton male,female; private JButton submit,exit; public Reservation() { setLayout(null); Font f=new Font("Times New Roman", Font.BOLD,22); Font f1=new Font("Arial",Font.BOLD,17); Font f2=new Font("Arial",0,16); JLabel title=new JLabel("Online Flight Ticket Reservation Form"); title.setFont(f); add(title).setBounds(200, 15, 480, 30); l1=new JLabel("Enter First name"); l2=new JLabel("Enter Last name"); firstname=new JTextField(20); lastname=new JTextField(20); l1.setFont(f1); l2.setFont(f1); firstname.setFont(f2); lastname.setFont(f2); add(l1).setBounds(200, 85, 180, 20); add(firstname).setBounds(450, 85, 200, 26); add(l2).setBounds(200, 135, 180, 20); add(lastname).setBounds(450, 135, 200, 26); l3=new JLabel("Select Gender"); male=new JRadioButton("Male"); female=new JRadioButton("Female"); male.setSelected(true); ButtonGroup group=new ButtonGroup(); group.add(male); group.add(female); l3.setFont(f1); add(l3).setBounds(200, 175, 180, 20);

male.setFont(f2); female.setFont(f2); add(male).setBounds(450, 175, 80, 26); add(female).setBounds(540, 175, 120, 26); l4=new JLabel("Select Starting city"); l5=new JLabel("Select Destination city"); String city[]={"Kolkatta", "Delhi","Mumbai", "Chennai", "Hyderabad", "Pune", "Bangalore"}; source=new JComboBox(city); dest=new JComboBox(city); l4.setFont(f1); l5.setFont(f1); source.setFont(f2); dest.setFont(f2); add(l4).setBounds(200, 215, 180, 20); add(l5).setBounds(200, 265, 280, 20); add(source).setBounds(450, 215, 180, 20); add(dest).setBounds(450, 265, 180, 20); l6=new JLabel("Select Journey Date"); String dvalue[]=new String[31]; for(int i=0;i<=30;i++) dvalue[i]=String.valueOf(i+1); day=new JComboBox(dvalue); String mvalue[]=new String[12]; for(int i=0;i<=11;i++) mvalue[i]=String.valueOf(i+1); month=new JComboBox(mvalue); String yvalue[]=new String[3]; yvalue[0]="2012"; yvalue[1]="2013"; yvalue[2]="2014"; year=new JComboBox(yvalue); l6.setFont(f1); add(l6).setBounds(200, 315, 280, 20); day.setFont(f2); add(day).setBounds(450, 315, 50, 26); month.setFont(f2); add(month).setBounds(515, 315, 50, 26); year.setFont(f2); add(year).setBounds(585, 315, 70, 26); String time[]=new String[13]; time[0]="Select"; for(int i=1;i<13;i++) time[i]=String.valueOf(i); atim=new JComboBox(time); dtim=new JComboBox(time); String tim[]={"AM","PM"}; JLabel a1=new JLabel("Arrival Time"); JLabel d1=new JLabel("Departure Time");

a1.setForeground(Color.GREEN); d1.setForeground(Color.GREEN); arr=new JComboBox(tim); dept=new JComboBox(tim); a1.setFont(f1); d1.setFont(f1); add(d1).setBounds(200, 365, 200, 20); add(dtim).setBounds(450, 365, 100, 20); add(dept).setBounds(580, 365, 50, 20); add(a1).setBounds(200, 415, 200, 20); add(atim).setBounds(450, 415, 100, 20); add(arr).setBounds(580, 415, 50, 20);

l7=new JLabel("Select Flight Company"); String c[]={"AirIndia","Indian Airlines","Jet Airways","KingFisher"}; company=new JComboBox(c); l7.setFont(f1); add(l7) .setBounds(200, 465, 280, 20); company.setFont(f2); add(company).setBounds(450, 465, 180, 26); l8=new JLabel("Enter Total Seats"); l9=new JLabel("Enter Total Fare"); seats=new JTextField(20); fare=new JTextField(20); l8.setFont(f1); l9.setFont(f1); fare.setFont(f2); seats.setFont(f2); add(l8).setBounds(200, 565, 180, 20); add(l9).setBounds(200, 615, 180, 20); add(seats).setBounds(450, 565, 200, 26); add(fare).setBounds(450, 615, 200, 20); submit=new JButton("Book"); exit=new JButton("Exit"); submit.setFont(f1); exit.setFont(f1); add(submit).setBounds(350, 665, 100, 26); add(exit).setBounds(460, 665, 100, 26); submit.addActionListener(this); exit.addActionListener(this); l1.setForeground(Color.GREEN); l2.setForeground(Color.GREEN);

l3.setForeground(Color.GREEN); l4.setForeground(Color.GREEN); l5.setForeground(Color.GREEN); l6.setForeground(Color.GREEN); l7.setForeground(Color.GREEN); l8.setForeground(Color.GREEN); l9.setForeground(Color.GREEN); setSize(1000,750); setVisible(true); setResizable(false); setTitle("Airline Reservation Form"); setLocation(0, 0); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==submit) {if(source.getSelectedItem()==dest.getSelectedItem()) { JOptionPane.showMessageDialog(this, "Did u forgot the destination :P"); } else if(atim.getSelectedItem()==dtim.getSelectedItem()) { if(arr.getSelectedItem()==dept.getSelectedItem()) { JOptionPane.showMessageDialog(this, "Arrival time and Departure Time are same"); } } else { int con=JOptionPane.showConfirmDialog(this, "Are you sure to Book ticket"); if(con==JOptionPane.YES_OPTION) { CreateTicket(); JOptionPane.showMessageDialog(this, "Ticket Saved Successfully"); System.exit(0); } else if(con==JOptionPane.NO_OPTION) { System.exit(0); } } } else if(ae.getSource()==exit) {

} }

System.exit(0);

public void CreateTicket() { Random ran=new Random(); int Number=ran.nextInt(100000); String jdate; String ticket="\n\n================"; ticket+=" Airport Authority of India "; ticket+="========================="; ticket+="\nTicket PNR number:"+Number; ticket+="\n\nPassenger FullName:"+firstname.getText()+" "+lastname.getText(); ticket+="\n\nStarting Place:"+source.getSelectedItem(); ticket+="\n\nDestination Place:"+dest.getSelectedItem(); jdate=""+day.getSelectedItem() +"-"+month.getSelectedItem()+"-"+year.getSelectedItem(); ticket+="\n\nArrival Time:"+jdate+" "+atim.getSelectedItem()+" "+arr.getSelectedItem()+" Departure Time: "+jdate+" "+dtim.getSelectedItem()+" "+dept.getSelectedItem(); ticket+="\n\nTotal Seats:"+seats.getText(); ticket+="\n\nTicket Amount:"+fare.getText(); ticket+="\n=========================================================== ============"; try{ File file=new File("Ticket_"+Number+".txt"); FileWriter fst=new FileWriter(file); BufferedWriter out=new BufferedWriter(fst); out.write(ticket); out.close(); System.out.println("File Created Successfully"); } catch(Exception e) { System.out.println("File Creation Error"); } } }

Output: LoginForm

ReservationForm

Ticket_86286: ================ Airport Authority of India ========================= Ticket PNR number:86286 Passenger FullName:kamal kannan Starting Place:Chennai Destination Place:Bangalore Arrival Time:3-4-2012 5 AM Departure Time: 3-4-2012 3 AM Total Seats:2 Ticket Amount:8000 ====================================================================

EX.NO:4

STOCK MAINTENANCE SYSTEM

AIM:
To analyze, design and develop code for air line reservation system using Argo-uml

PROBLEM STATEMENT Stock Maintenance gives an idea about how products are maintained in the
Particular concern. The products that are to be purchased, the products that are to be sold are maintained here. This project also gives idea about the faults in the purchased product and the products that are to be replaced also been given. Further some additional details of the current stock that is available in the store is also given. Stock maintenance in this project is done in an authorized way. The password and user id has been set here. As a whole the marketing process can be improved if the stock is maintained properly. The stock has to be maintained properly since the whole marketing process can be improved. Stock maintenance in this project gives the idea about how products are maintained in a particular concern. The stock details which includes the amount of stock available, the stock is to be purchased, the date or the time it is being bought or delivered, the amount that is already available are maintained in this project. The stock maintenance in this project is understood by going through the modules that is being involved. The whole economic status is being improved properly if stock is maintained.

UML DIAGRAMS: USECASE DIAGRAM:

LASS DIAGRAM:

SEQUENCE DIAGRAM:

ACTIVITY DIAGRAM:

CODING: LoginForm.java
import java.awt.*; import java.awt.event.ActionEvent;

import java.awt.event.ActionListener; import javax.swing.*; import java.sql.*; class LoginForm extends JFrame implements ActionListener { JTextField t1; JPasswordField t2; /*** Constructor for desgin login Form details ***/ public LoginForm() { Font f1 = new Font("Courier",Font.BOLD,38); Font f2 = new Font("Courier",Font.BOLD,18); setLayout(null); JLabel l1=new JLabel("Sales Inventory Management System"); l1.setFont(f1); l1.setForeground(Color.GREEN); add(l1).setBounds(160, 10, 800, 50); JLabel l3=new JLabel("Enter Login Name"); t1=new JTextField(20); JLabel l4=new JLabel("Enter Password "); t2=new JPasswordField (20); add(l3).setBounds(350, add(l4).setBounds(350, add(t1).setBounds(470, add(t2).setBounds(470, 200, 230, 200, 230, 200, 200, 150, 150, 20); 20); 20); 20);

JButton b1=new JButton("Login"); JButton b2=new JButton("Exit"); add(b1).setBounds(400, 270, 80, 20); add(b2).setBounds(500, 270, 80, 20); b1.addActionListener(this); b2.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Inventory Management System"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Login")) { String username = t1.getText(); String password = t2.getText(); String db_Password ="";

try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///Inventory","root", "root"); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select password from login where loginname = '" + username +"'"); while(rs.next()) { db_Password = rs.getString(1); } if(password.equals(db_Password) && db_Password.length() != 0) Password"); } else { { //JOptionPane.showMessageDialog(this,"Correct MainPage mp = new MainPage(); this.setVisible(false);

JOptionPane.showMessageDialog(this,"Enter correct Username and Password"); t1.setText(""); t2.setText(""); } } catch(Exception e) { e.printStackTrace(); } } else if(str.equals("Exit")) { System.exit(0); } } public static void main(String args[]) { LoginForm form = new LoginForm(); } }

MainPage.java
import import import import

java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

import java.sql.*; class MainPage extends JFrame implements ActionListener { public MainPage() { setLayout(null); JButton b1=new JButton("Product Inflow"); JButton b2=new JButton("Product Outflow"); JButton b4=new JButton("Show Product Inflow"); JButton b5=new JButton("Show Product Outflow"); JButton b3=new JButton("Exit"); add(b1).setBounds(150, add(b2).setBounds(300, add(b4).setBounds(470, add(b5).setBounds(670, 170, 170, 170, 170, 120, 30); 150, 30); 170, 30); 170, 30);

add(b3).setBounds(430, 220, 100, 20); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Inventory - Main Form"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Product Inflow")) { Inflow i = new Inflow(); } else if(str.equals("Product Outflow")) { Outflow o = new Outflow(); } else if(str.equals("Exit")) { System.exit(0); } else if(str.equals("Show Product Inflow")) { ShowInflow s = new ShowInflow(); }

else if(str.equals("Show Product Outflow")) { ShowOutflow s = new ShowOutflow(); } } public static void main(String args[]) { LoginForm form = new LoginForm(); }

Inflow.java
import import import import import import import import import import java.io.*; java.sql.Connection; java.sql.DriverManager; java.sql.ResultSet; java.sql.Statement; java.util.*; java.awt.Font; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

public class Inflow extends JFrame implements ActionListener { private private private private JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9; JTextField id, name,company,quantity,validity; JComboBox day,month,year; JButton submit,exit;

public Inflow() { setLayout(null); Font f = new Font("TimesNewRoman",Font.BOLD,22); Font f1 = new Font("Arial",Font.BOLD,17); Font f2 = new Font("Arial",0,16); JLabel title=new JLabel("Sales Inventory - Product Inflow Form"); title.setFont(f); add(title).setBounds(250, 15, 480, 30); /*** Passenger First Name and LastName ***/ l1=new JLabel("Enter Product ID"); id=new JTextField(20); l2=new JLabel("Enter Product Name"); name=new JTextField(20);

l1.setFont(f1); add(l1).setBounds(250, 85, 180, 20); id.setFont(f2); add(id).setBounds(450, 85, 200, 26); l2.setFont(f1); add(l2).setBounds(250, 135, 180, 20); name.setFont(f2); add(name).setBounds(450, 135, 200, 26); l3 = new JLabel("Enter Manufacturer"); l3.setFont(f1); add(l3).setBounds(250, 175, 180, 20); company = new JTextField(20); company.setFont(f2); add(company).setBounds(450, 175, 200, 26); /*** Date, Month, Year ***/ l6 = new JLabel("Select Inflow Date"); String dvalue[]=new String[31]; for(int i=0;i<=30;i++) dvalue[i]=String.valueOf(i+1); day=new JComboBox(dvalue); String mvalue[]=new String[12]; for(int i=0;i<=11;i++) mvalue[i]=String.valueOf(i+1); month=new JComboBox(mvalue); String yvalue[]=new String[3]; yvalue[0]="2011"; yvalue[1]="2012"; yvalue[2]="2013"; year=new JComboBox(yvalue); l6.setFont(f1); add(l6).setBounds(250, 215, 180, 20); day.setFont(f2); add(day).setBounds(450, 215, 50, 26); month.setFont(f2); add(month).setBounds(515, 215, 50, 26); year.setFont(f2); add(year).setBounds(580, 215, 75, 26); l8=new JLabel("Enter Total Quantity"); quantity=new JTextField(20); l9=new JLabel("Enter Validity in days"); validity=new JTextField(20); l8.setFont(f1); add(l8).setBounds(250, 265, 180, 20); quantity.setFont(f2);

add(quantity).setBounds(450, 265, 200, 26); l9.setFont(f1); add(l9).setBounds(250, 315, 180, 20); validity.setFont(f2); add(validity).setBounds(450, 315, 200, 26); submit=new JButton("Submit"); exit=new JButton("Back"); submit.setFont(f1); exit.setFont(f1); add(submit).setBounds(350, 365, 100, 26); add(exit).setBounds(460, 365, 100, 26); submit.addActionListener(this); exit.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Inventory - Product Inflow Form"); setLocation(0,0); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

public void actionPerformed(ActionEvent ae) { if(ae.getSource()==submit) { int pid = Integer.parseInt(id.getText()); String pname = name.getText(); String manu = company.getText(); String idate = (String) day.getSelectedItem() +"-"+month.getSelectedItem()+"-"+year.getSelectedItem(); int quan = Integer.parseInt(quantity.getText()); int valid = Integer.parseInt(validity.getText()); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///Inventory","root", "root"); Statement st = conn.createStatement(); st.executeUpdate("insert into inflow values(" + pid + ",'"+ pname +"','" + manu + "','" + idate +"'," + quan + "," + valid +")") ; JOptionPane.showMessageDialog(this, "Product Inflow Saved Successfully..."); this.setVisible(false); }

catch(Exception e) { e.printStackTrace(); this.setVisible(false); } } else if(ae.getSource()== exit) { //System.exit(0); this.setVisible(false); } }

Outflow.java
import import import import import import import import import import java.io.*; java.sql.Connection; java.sql.DriverManager; java.sql.ResultSet; java.sql.Statement; java.util.*; java.awt.Font; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

public class Outflow extends JFrame implements ActionListener { private private private private JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9; JTextField id, name,company,quantity; JComboBox day,month,year, mode; JButton submit,exit;

public Outflow() { setLayout(null); Font f = new Font("TimesNewRoman",Font.BOLD,22); Font f1 = new Font("Arial",Font.BOLD,17); Font f2 = new Font("Arial",0,16); Form"); JLabel title=new JLabel("Sales Inventory - Product Outflow title.setFont(f);

add(title).setBounds(250, 15, 480, 30); /*** Passenger First Name and LastName ***/ l1=new JLabel("Enter Product ID"); id=new JTextField(20); l2=new JLabel("Enter Product Name"); name=new JTextField(20); l1.setFont(f1); add(l1).setBounds(250, 85, 180, 20); id.setFont(f2); add(id).setBounds(450, 85, 200, 26); l2.setFont(f1); add(l2).setBounds(250, 135, 180, 20); name.setFont(f2); add(name).setBounds(450, 135, 200, 26); l3 = new JLabel("Enter Agency Name"); l3.setFont(f1); add(l3).setBounds(250, 175, 180, 20); company = new JTextField(20); company.setFont(f2); add(company).setBounds(450, 175, 200, 26); /*** Date, Month, Year ***/ l6 = new JLabel("Select Inflow Date"); String dvalue[]=new String[31]; for(int i=0;i<=30;i++) dvalue[i]=String.valueOf(i+1); day=new JComboBox(dvalue); String mvalue[]=new String[12]; for(int i=0;i<=11;i++) mvalue[i]=String.valueOf(i+1); month=new JComboBox(mvalue); String yvalue[]=new String[3]; yvalue[0]="2011"; yvalue[1]="2012"; yvalue[2]="2013"; year=new JComboBox(yvalue); l6.setFont(f1); add(l6).setBounds(250, 215, 180, 20); day.setFont(f2); add(day).setBounds(450, 215, 50, 26); month.setFont(f2); add(month).setBounds(515, 215, 50, 26); year.setFont(f2); add(year).setBounds(580, 215, 75, 26);

l8=new JLabel("Enter Total Quantity"); quantity=new JTextField(20); l9=new JLabel("Payment Mode"); String smode[]=new String[3]; smode[0]="Cash"; smode[1]="Cheque"; smode[2]="Demand Draft"; mode=new JComboBox(smode); //validity=new JTextField(20); l8.setFont(f1); add(l8).setBounds(250, 265, 180, 20); quantity.setFont(f2); add(quantity).setBounds(450, 265, 200, 26); l9.setFont(f1); add(l9).setBounds(250, 315, 180, 20); mode.setFont(f2); add(mode).setBounds(450, 315, 200, 26); submit=new JButton("Submit"); exit=new JButton("Back"); submit.setFont(f1); exit.setFont(f1); add(submit).setBounds(350, 365, 100, 26); add(exit).setBounds(460, 365, 100, 26); submit.addActionListener(this); exit.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Inventory - Product Outflow Form"); setLocation(0,0); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==submit) { int pid = Integer.parseInt(id.getText()); String pname = name.getText(); String manu = company.getText(); String odate = (String) day.getSelectedItem() +"-"+month.getSelectedItem()+"-"+year.getSelectedItem(); int quan = Integer.parseInt(quantity.getText()); String cmode =(String) mode.getSelectedItem();

try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///Inventory","root", "root"); Statement st = conn.createStatement(); st.executeUpdate("insert into Outflow values(" + pid + ",'"+ pname +"','" + manu + "','" + odate +"'," + quan + ",'" + cmode +"')") ; JOptionPane.showMessageDialog(this, "Product Outflow Saved Successfully..."); this.setVisible(false); } catch(Exception e) { e.printStackTrace(); this.setVisible(false); } } else if(ae.getSource()== exit) { //System.exit(0); this.setVisible(false); } }

ShowInflow.java
import import import import java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

import java.sql.*;

class ShowInflow extends JFrame implements ActionListener { public ShowInflow() { Font f1 = new Font("Courier",Font.BOLD,38); Font f2 = new Font("Courier",Font.BOLD,18); Font f3 = new Font("Verdana",Font.BOLD,15); setLayout(null); JLabel l1=new JLabel("Product Inflow Details"); l1.setFont(f1); l1.setForeground(Color.BLUE); add(l1).setBounds(160, 10, 800, 50); int count=0; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///Inventory","root", "root"); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select * from inflow"); while(rs.next()) { count++; } //System.out.println("count = " + count); rs = st.executeQuery("select * from inflow"); String data[][] = new String [count][6]; int i=0; while(rs.next()) { data[i][0] data[i][1] data[i][2] data[i][3] data[i][4] data[i][5] i++; } JLabel l2=new JLabel("ProductID"); JLabel l3=new JLabel("Product Name"); JLabel l4=new JLabel("Manufacturer"); JLabel l5=new JLabel("Inflow Date "); JLabel l6=new JLabel("Quantity"); JLabel l7=new JLabel("Valitity"); add(l2).setBounds(50, 100, 78, 20); add(l3).setBounds(200, 100, 100, 20); = = = = = = rs.getString("pid"); rs.getString("pname"); rs.getString("company"); rs.getString("idate"); rs.getString("quantity"); rs.getString("validity");

add(l4).setBounds(350, add(l5).setBounds(500, add(l6).setBounds(650, add(l7).setBounds(800,

100, 100, 100, 100,

100, 100, 100, 100,

20); 20); 20); 20);

String title[] = {"ID", "Product Name", "Manu","Inflow Date", "Quantity", "Valitity"}; JTable jt = new JTable( data, title ); JScrollPane pane = new JScrollPane(jt); jt.setFont(f3); add(jt).setBounds(50, 120, 900, 200); } catch(Exception e) { e.printStackTrace(); this.setVisible(false); } JButton b1=new JButton("Back"); add(b1).setBounds(400, 470, 80, 20); b1.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Product Inflow"); } public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Back")) { //System.exit(0); this.setVisible(false); } } }

ShowOutflow.java
import import import import java.awt.*; java.awt.event.ActionEvent; java.awt.event.ActionListener; javax.swing.*;

import java.sql.*; class ShowOutflow extends JFrame implements ActionListener

public ShowOutflow() { Font f1 = new Font("Courier",Font.BOLD,38); Font f2 = new Font("Courier",Font.BOLD,18); Font f3 = new Font("Verdana",Font.BOLD,15); setLayout(null); JLabel l1=new JLabel("Product Outflow Details"); l1.setFont(f1); l1.setForeground(Color.BLUE); add(l1).setBounds(140, 10, 800, 50);

int count=0; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql:///Inventory","root", "root"); Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("select * from outflow"); while(rs.next()) { count++; } //System.out.println("count = " + count); rs = st.executeQuery("select * from outflow"); String data[][] = new String [count][6]; int i=0; while(rs.next()) { data[i][0] = data[i][1] = data[i][2] = data[i][3] = data[i][4] = data[i][5] = i++; } JLabel l2=new JLabel("ProductID"); JLabel l3=new JLabel("Product Name"); JLabel l4=new JLabel("Agency Name"); JLabel l5=new JLabel("Outflow Date "); JLabel l6=new JLabel("Quantity"); JLabel l7=new JLabel("Payment Mode"); add(l2).setBounds(50, 100, 78, 20); add(l3).setBounds(200, 100, 100, 20); add(l4).setBounds(350, 100, 100, 20); add(l5).setBounds(500, 100, 100, 20);

rs.getString(1); rs.getString(2); rs.getString(3); rs.getString(4); rs.getString(5); rs.getString(6);

add(l6).setBounds(650, 100, 100, 20); add(l7).setBounds(800, 100, 100, 20); String title[] = {"ID", "Product Name", "Manu","Inflow Date", "Quantity", "Valitity"}; JTable jt = new JTable( data, title ); JScrollPane pane = new JScrollPane(jt); jt.setFont(f3); add(jt).setBounds(50, 120, 900, 200); } catch(Exception e) { e.printStackTrace(); this.setVisible(false); } JButton b1=new JButton("Back"); add(b1).setBounds(400, 470, 80, 20); b1.addActionListener(this); setSize(1000, 650); setVisible(true); setResizable(false); setTitle("Sales Product Outflow");

} public void actionPerformed(ActionEvent ae) { String str=ae.getActionCommand(); if(str.equals("Back")) { //System.exit(0); this.setVisible(false); } }

DATABASE QUERIES: create database Inventory; use Inventory; create table login (loginname varchar(16), password varchar(16)); insert into login values('admin','inventory');

create table inflow (pid int, pname varchar(32), company varchar(32), idate varchar(12), quantity int, validity int); create table outflow (pid int, pname varchar(32), agencyname varchar(32), odate varchar(12), quantity int, paymentmode varchar(16));

OUTPUT: LoginForm:

MainPage

Inflow

Outflow

ShowInflow

ShowOutflow:

On MySQL Command Line:

EX.NO:4

LIBRARY MANAGEMENT SYSTEM


AIM : To analyze, design and develop code for LIBRARY MANAGEMENGT SYSTEM using Argo-uml PROBLEM STATEMENT:
A library lends books and magazines to members who are registered in the system. It also handles the purchases of new books and magazines for the library. Popular titles are brought in multiple copies. Books and magazines are removed when they are out dated (or) in poor conditions. A member can reserve a book or a magazine that is not currently available, so that it can be notified to the reserved person when it is return or purchased by library. The library can create, update

(or) delete information about the books (or) delete information about the books (or) members and borrowings.

Modular Description MODULE 1 Provide a user interface for getting the users login details. Verify login ID and if correct, provide access to the library database. MODULE 2 Provide a search mechanism to search for a particular book. Input the book name and the authors name. MODULE 3 Get the book details from the database. Display the book details on the screen. MODULE 4 Allow the user to select the book for checking out. Issue the book.

UML DIAGRAMS: USE CASE DIAGRAM:

CLASS DIAGRAM:

SEQUENCE DIAGRAM:

COLLABORATION DIAGRAM:

ACTIVITY DIAGRAM:

COMPONENT DIAGRAM:

You might also like