Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

2018 IPT Lab Manual

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 42

DEPARTMENT OF INFORMATION TECHNOLOGY

FACULTY OF ENGINEERING & TECHNOLOGY

SUBJECT TITLE: INTEGRATIVE PROGRAMMING


&TECHNOLOGY LAB
SUBJECT CODE: IT1022

Name:

Register Number:

Department of Information Technology

SRM INSTITUE OF SCIENCE AND TECHNOLOGY, SRM Nagar,


Kattankulathur-603203
Kancheepuram District, Tamil Nadu
15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST Page |2


15IT411J –Integrative Programming and Technology Laboratory

TABLE OF CONTENT
Date Ex.No Name of the Experiment Mark Signature

I:JAVA NATIVE INTERFACE-JNI


1 a. Object Passing
1 b. Sorting Array
1 c. Different Data Types and Exception handling
II:JAVA BEANS
2 a. Account Details –Using Non-Visual Bean
2 b. Color Bean – Using Visual Bean
III: ENTERPRISE JAVA BEAN
3 a. Stateful Session Bean for Bank Application
3 b. Stateless session Bean for Shopping Cart
IV.JMS
4 a. Developing JMS Application

V.JYTHON
5 a. Simple Swing application in Java using Jython

VI. DJANGO
6 a. Web application with Django using Jython

Department of Information Technology, SRMIST Page |3


15IT411J –Integrative Programming and Technology Laboratory

SYLLABUS

PURPOSE
This course enables the students to practice and implement various concepts like RMI, JAVA
BEANS, and Web services using EJB.

INSTRUCTIONAL OBJECTIVES
After successful completion of the course, the students should be able to
• Implement distributed application using RMI.
• Implement distributed components such as Java bean, EJB
• Implement Language interoperability program using JNI

LIST OF EXERCISES

JNI
 Object passing
 Array sorting
 Exception handling

JAVA BEAN
 Create a simple bean components using java class and swing class

ENTERPRISE JAVA BEAN


 Create a session, message driven and entity component
 Create a web services
 Create a design pattern

JMS
 Developing JMS Application

JYTHON
 Simple Swing application in Java using Jython

DJANGO
 Web application with Django using Jython

REFERENCE:
1. Integrative Programming and Technologies Lab Manual, Department of Information
Technology, SRMIST.
TOTAL 60

Department of Information Technology, SRMIST Page |4


15IT411J –Integrative Programming and Technology Laboratory

Rubrics
Experiment Max.
Grading Rubrics
Component Marks
Program is well Missing two or more
documented. The required comments .The
Documentatio documentation is well documentation is simply
n/ 2 written and clearly embedded comments
Procedure explains what the code and does not help the
is accomplishing and reader understand the
how(2 marks) code(1 mark)
Completeness Completeness
of code, of code,
consistent consistent Completeness of
variable variable code, consistent
naming and naming and variable naming
formatting, formatting, and formatting,
well well well commented,
commented, commented, uses existing
Program 3
uses existing uses existing skills in new
skills in new skills in new ways/learns new
ways/learns ways/learns skills to solve the
new skills to new skills to experimental
solve the solve the problem. (1
experimental experimental mark)
problem. (3 problem. (2
marks) marks)
Program is free
Program is of errors and Program
free of errors output is not contains few
and output is properly logical errors
well formatted. formatted. and output is not
Demonstrates Demonstrates formatted.
Program Excellent a clear Demonstrates
3
Execution problem understanding partial
solving and of the understanding of
creativity concepts the concepts
skills. relevant to the relevant to the
(3 marks) experiment. experiment.
(2 marks) (1 mark)

Program 2 Decision control logic, Decision control logic,


Testing loop logic in program loop logic in program
exhibits proper exhibits proper functional
functional behavior and behavior and Output is

Department of Information Technology, SRMIST Page |5


15IT411J –Integrative Programming and Technology Laboratory

Output is obtained for


obtained for varying sets
varying sets of input
of input data. (1 mark)
data. (2 marks)

JNI

Department of Information Technology, SRMIST Page |6


15IT411J –Integrative Programming and Technology Laboratory

Exercise 1A JNI - Object Passing


Date:

Question:Create a JNI program to pass object as argument from java to c program.

Aim:

Procedure:
1) Create a Java Application named as “Exercise2_JNI” with a java main class named as
“PassingObject” and a java class named as “SimpleClass”
2) In the “SimpleClass” file do the following
a. Declare a variable int count;
b. Define a method named “Increment()” to increment the count value by 10 as
count=count*10; and print the count value inside the method.
3) In the “PassingObject” class/file do the following
a. Define a native method declaration as follows
public static native void changecountvalue ( SimpleClass sc); and inside the main()
method perform the following
1. Create the obj for SimpleClass as sc,
2. assign the value of count to 10,
3. invoke the Increment() method,
4. invoke changecountvalue by passing ‘sc’ as argument ,
5. print the value of count before and after changecountvalue() method call.
4) Create a C/C++ application project named as “Excercise2_JNI_C” with “PassingObject.c”
file in it.
Create headerfile & perform the necessary step to change the value of count from c program.

Program:

Department of Information Technology, SRMIST Page |7


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST Page |8


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST Page |9


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Exercise 1B JNI –Sorting Array


Department of Information Technology, SRMIST P a g e | 10
15IT411J –Integrative Programming and Technology Laboratory

Date:

Question:Create a JNI program to sort the values in an array by using C++ application.

Aim:

Procedure:
1. Create a java main class named as “Sorting_array” which contain only one native method as
follows
public native int[] ArraySorting (int[] array);
and a static array declaration as
Static int array[];
within the main() method perform the following.
a. get the length of the array
b. now using length create a new array
c. from user get the values for the array
d. call the method ArraySorting (int []) by passing the array values got from the user.
e. assign the return value of ArraySorting() method to a new array variable called as
sorted_array[] and print the sorted_array[] values.

2. create a c/c++ application with “Sorting_Array.c” file


create headerfile & perform the necessary step to sort the values either in ascending or
descending order using C++ and return the sorted array to the jave code.

Program:

Department of Information Technology, SRMIST P a g e | 11


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 12


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 13


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 14


15IT411J –Integrative Programming and Technology Laboratory

Exercise 1C JNI – Different Data Types and Exception handling


Date:

Question:Create a JNI program to use different types such as int, float, String & Exception
Handling with c program.

Aim:

Procedure:
1. create a java main class called as “Exception_Difftypes”
Define the following method(s) declaration
a. public native int intMethod (int n);
b. public native Boolean booleanMethod (boolean text)
c. public native string stringMethod (String text);
d. public native void doit() throws IllegalArgumentException;
and the following method definition
e. public void callback () throws NullPointerException
{
throw new NullPointerException(“CatchThrow.callback”)
}
Inside the main () function perform the following
Create the object of the class and invoke the method a, b, c and print the values returned
by them.
In try… catch block call the d & e method.
2. Create a C/C++ application with “Exception_Differenttype.c” file
Create headerfile & perform the following operation in different method.
a. intMethod ()  return the product of 2 No’s
b. booleanMethod ()  return the !boolean value
c. StringMethod ()  return the uppercase string
d. doit ()  to throw the exception

Program:

Department of Information Technology, SRMIST P a g e | 15


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 16


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 17


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 18


15IT411J –Integrative Programming and Technology Laboratory

MSMQ Using VB

Department of Information Technology, SRMIST P a g e | 19


15IT411J –Integrative Programming and Technology Laboratory

Exercise 2A Passing message using MSMQ


Date:

Question: Create a application using VB for sending message using MSMQ concept

Aim:

Procedure:
Create a STDEXE VB application named as “QWriter” with the following form design and write
the necessary code to update the message in the MSMQ object

Text box 1 named as txtlabel and text box 2 named as txtbody and command button named as
cmdsend

Create a STDEXE VB application named as “QReader” with the following form design and
write the necessary code to retrieve the message from the MSMQ object

Text Box named as txtLog, Button named as cmdDeleteQ, and a timer named as tmrTerminate

Department of Information Technology, SRMIST P a g e | 20


15IT411J –Integrative Programming and Technology Laboratory

Program:

Department of Information Technology, SRMIST P a g e | 21


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 22


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 23


15IT411J –Integrative Programming and Technology Laboratory

JAVA BEANS

Department of Information Technology, SRMIST P a g e | 24


15IT411J –Integrative Programming and Technology Laboratory

Exercise 3A Account Details –Using Non-Visual Bean


Date:

Question: Develop a JAVA Bean to calculate the current balance in your account and display
the balance detail as a message using JFrame.

Aim:

Procedure:
1. Create a java bean class named as ‘AccountDetail_Bean’. Define the following
Properties
a. private String Date
b. private long Acct_no
c. private String Name
d. private double Withdraw_amount
e. private final double Balance_amt = 100000
Methods
a. public void generate_SystemDate( )
It gets the system date and from this call setDate( ) method.
b. public double current_balance( )
This method calculates balance as balance = Balance_amt –
withdraw_amount. If balance_amt is less than Withdraw_amount then
return balance_amt itself, otherwise return the balance calculated.
2. Create another project with java swing Form. In this create a JFrame called as
Account_Form. Design the form with following details.

Department of Information Technology, SRMIST P a g e | 25


15IT411J –Integrative Programming and Technology Laboratory

3. On double clicking the “OK” button


a. Set Accountno,name,Withdraw_amount, values of Bean class by the values
entered in the jtextfield Text_AccountNo, Text-Name and Text_withdraw
respectively.
b. Get the balance from the Bean class and set the “Text-balance” jtextfield Box
with it.
c. Calculate the current balance by invoking the method current_balance( ) defined
in Bean class and set the calculated current balance to the label “lbl_Balance”.
4. On double clicking the ‘Message button
5. Display the message as “Balance in your Account no: <acc_no> as on <date> is
<balance_amt>”
6. The message should be displayed using JoptionPane.showMessageDialog(null, output,
“sms”, 1)

Program:

Department of Information Technology, SRMIST P a g e | 26


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 27


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 28


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 29


15IT411J –Integrative Programming and Technology Laboratory

Exercise 3B Color Bean – Using Visual Bean


Date:

Question: Create a visual java bean using mouse event for moving a small oval along with the
cursor point.

Aim:

Procedure:
1. Design a Java Bean class named as “MouseMove_Bean” extends JPanel class.
with properties :- private int Circle_size=20
private int xm, ym ;
method:- private color randomColor() {……}
> used to generate random colors.
[Hint- use predefined color() class  takes 3 int org for color() constructor.Math.random() used
to provide random no.]
Overridden methods ( From JPanel)
a. public void paintComponent (Graphics g)
Set the color by calling random color () method & draw the oval with the “Circlesize”
property defined above
b. public Dimension get( )
Return new Dimension (200, 200) for setting the size of the JPanel
Inside the Constructor
a. Set the background for the JPanel (Bean created) and addMouseMotionListener to
perform Mousemoved event.
b. Inside the MouseMoved () event method get the x, y position of the cursor and set it from
xm & ym variables.
Note :- While drawing the oval use xm, ym, circle-size, so that circle moves when xm, ym
changes when mouse is moved.
2.Design a JApplet Form called as “MouseMove_Form”
Here drag & drop the above bean created.
3.Execute the JApplet.

Program:

Department of Information Technology, SRMIST P a g e | 30


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 31


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 32


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 33


15IT411J –Integrative Programming and Technology Laboratory

ENTERPRISE JAVA BEAN

Department of Information Technology, SRMIST P a g e | 34


15IT411J –Integrative Programming and Technology Laboratory

Exercise 4A Stateful Session Bean – Banking Application


Date:

Question: Create a stateful session bean for Banking Application.

Aim:

Procedure:
1) Create a Java class Library named as “ Exercise5A_Remote”
2) Create JavaEE Enterprise Application named as “Exercise5A_EntAppln_BankAppln”
3) In Exercise5A_EntAppln_BankAppln-ejb project add a java class file named as
“Bank.java” under “ejbpkg” user defined package
a. Include the following methods inside Bank.java
i. void withDraw(int amount) for reducing the balance
ii. void deposit(int dep_amt)for adding the balance
iii. int balance() to return the balance amount
b. One variable int balance =100000
4) Create JavaEE Enterprise Application Client named as
“Exercise5A_BankAppln_Client” with one java main class named as
“Bank_Client.java” under the auto generated package same as the project name.
a. Inside the Bank_client file under main function do the following operation for
two different customers
i. Use choice, amount as int variables
ii. Get any one choice as follows with a variable int choice.
 1To withdraw – call the method withdraw() by passing amount
as parameter to reduce the balance
 2To deposit – call the method deposit() by passing amount to
add the amount to the balance
 0 To finish the transaction
iii. Repeat the above process for a single customer minimum of 5 times

Program:

Department of Information Technology, SRMIST P a g e | 35


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 36


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 37


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 38


15IT411J –Integrative Programming and Technology Laboratory

Exercise 4B Stateless Session Bean – Shopping Cart


Date:

Question: Create a stateless session bean for shopping cart application.

Aim:

Procedure:
5) Create a Java class Library named as “ Exercise5B_Remote”
6) Create JavaEE Enterprise Application named as “Exercise5B_EntAppln_ShopCart”
7) In Exercise5B_EntAppln_ShopCart-ejb project add a java class file named as
“Shop.java” under “ejbpkg” user defined package
a. Include the following methods inside Shop.java
i. void addItem(int parameter) for adding item
ii. void removeItem(int buy)for reducing the item count
iii. int stock() to return the item value
b. One variable int item=0;
8) Create JavaEE Enterprise Application Client named as “Exercise5B_Shopcart_Client”
with one java main class named as “Shop_Client.java” under the auto generated package
same as the project name.
a. Inside the Shop_client file under main function do the following operation for
two different customers
i. Use choice, no_items as int variables
ii. Get any one choice as follows with a variable int choice.
 1To buy – call the method removeItem() by passing no:of items
(no_items) to buy as parameter
 2To Add – call the method addItem() by passing no:of
items(no_items) to add to stock
 0 To finish the transaction
iii. Repeat the above process for a single customer minimum of 5 times

Program:

Department of Information Technology, SRMIST P a g e | 39


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 40


15IT411J –Integrative Programming and Technology Laboratory

Department of Information Technology, SRMIST P a g e | 41


15IT411J –Integrative Programming and Technology Laboratory

Sl No: Assessment Process Description Mark(s)


1 Documentation/Procedure(2)
2 Program(3)
3 Program Execution(3)
4 Program Testing(2)
Total(10)
Remarks

Date of Completion: Signature

Result:

Department of Information Technology, SRMIST P a g e | 42

You might also like