2018 IPT Lab Manual
2018 IPT Lab Manual
2018 IPT Lab Manual
Name:
Register Number:
TABLE OF CONTENT
Date Ex.No Name of the Experiment Mark Signature
V.JYTHON
5 a. Simple Swing application in Java using Jython
VI. DJANGO
6 a. Web application with Django using Jython
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
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
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)
JNI
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:
Result:
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.
Program:
Result:
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:
Result:
MSMQ Using VB
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
Program:
Result:
JAVA BEANS
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.
Program:
Result:
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:
Result:
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.
1To withdraw – call the method withdraw() by passing amount
as parameter to reduce the balance
2To 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:
Result:
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.
1To buy – call the method removeItem() by passing no:of items
(no_items) to buy as parameter
2To 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:
Result: