You are on page 1of 64

Ex No: 1 Date:

WEBSITE CREATION FOR FACULTY DEVELOPMENT PROGRAM

Aim: To develop a website for faculty development program using DHTML and CSS. Procedure: 1. Create the main.html with three frames using the tag as follows <frameset rows="30%,*" border="10" framespacing="0"> <frame src=top.html name=top> </frame> 2. follows Create the home.html that is on the right side of first.html with the CSS style as <style type="text/css"> body { background-image: url("img149.jpg"); background-repeat: repeat } h1 {background-color: pink} h2 {background-color: transparent} p {background-color: rgb(25,20,25)} </style> The stylesheet is stored in a seperate file which can be linked to any number of html documents using the follwing tag. <link rel="stylesheet" href="style.css"> 3. The home.html is having the files of home.html, course.html, syllabus.html, schedule.html, fees.html, regulations.html and contacts.html each gives the details about the appropriate FDP regarding details. 4. The syllabus link of the details.html has created as rich text format using the tag <a href = "syllabus.rtf" target = right>Syllabus</a> 5. In home.html the body background image has set using <body background = "J0148309.jpg">

6. Hyperlinks can be given using <a href = "tau.org.in">Click here to view the website of AnnaUniversity of Technology , Tiruchirapalli </a>

7. In fees.html the table has created using the tag <table border = "1"> <h1><center><font color= blue> Fees Details :-<tr> <th> <font color= brown>Serial</th> <th><font color= brown>Details</th> <th><font color= brown>Fees</th> </tr> 9.The word FACULTY DEVELOPMENT PROGRAM has scrolled horizontally using <marquee> <h3><center>FACULTY DEVELOPMENT PROGRAM

Program: main.html <html> <head> </head> <body bgcolor= skyblue> <a href="home.html" target=right> <img src="home.jpg"></a><br> <a href="course.html" target=right><img src="course.jpg"></a><br> <a href="fees.html" target=right><img src="fee.jpg"></a><br> <a href="syllabus.html" target=right><img src="syl.jpg"></a><br> <a href="exam.html" target=right><img src="exam.jpg"></a><br> <a href="reg2008.pdf" target=right><img src="reg.jpg"></a><br> <a href="Schedule.pdf" target=right><img src="sch.jpg"></a><br> <a href="contact.html" target=right><img src="cont.jpg"></a><br> </body> </html> smain.css body { background-color:skycolor; } h1{ class="veryimportant"; font-size: 20pt; color: red; } p { font-size: 16pt; word-spacing:1 em; text-indent: 0.5in; } a:link{color:blue;} a:visited{color:red;} right.html <html> <body bgcolor=lightpink> <p>Anna University is offering several courses for the students as well as for the faculty members. </p> </body> </html>

left.html <html> <head> </head> <body bgcolor= skyblue> <a href="home.html" target=right> <img src="home.jpg"></a><br> <a href="course.html" target=right><img src="course.jpg"></a><br> <a href="fees.html" target=right><img src="fee.jpg"></a><br> <a href="syllabus.html" target=right><img src="syl.jpg"></a><br> <a href="exam.html" target=right><img src="exam.jpg"></a><br> <a href="reg2008.pdf" target=right><img src="reg.jpg"></a><br> <a href="Schedule.pdf" target=right><img src="sch.jpg"></a><br> <a href="contact.html" target=right><img src="cont.jpg"></a><br> </body> </html> head.html <html> <head> </head> <body bgcolor=skyblue> <center><img src="logo.jpg" height=160 width=1250> </body> </html> home.html <html> <head> <title>M.E(CSE) - MBCBS Home Page</title> <link rel="stylesheet" href="smain.css"> </head> <body bgcolor=skyblue> <h1><strong>About College</strong></h1> <p><h3 align="justify"> Anna University, Trichy has been started during the year of 2007 at Bharathidasan Univeristy campus </h3></p> <h1><u>Vision</u></h1> <h3 align="justify">To actively support an academic environment as a Central Comprehensive Learning Centre that commits for the intellectual development of all learners through courses, Training Programmes and discipline specific assistance that helps them succeed in their careers and life. </h3> <h1><u>Mission</u></h1> 4

<h3> <ul> <li>To support an enhanced educational experience to academically talented and highly motivated students <br> <br><li>To design, in collaboration with faculty recognized for excellence in teaching, an innovative, inter disciplinary and multidisciplinary curriculum that emphasizes critical thinking, collaborative learning and communication skills <br> <br><li> To supplement curriculum with enriched academic opportunities consisting of Study Smarter Programmes (SSP) , Campus Placement Training Programmes (CPTP), Soft Skills Development Programme (SSDP), Short Term Training Programmes (STTP) , Faculty Development Programmes (FDP) , Learn by Doing Practices (LDP), and Supplemental Instruction (SI) to help the students to improve the </ol> </h3> </body> course.html <html> <head> <title>M.E(CSE)-MBCBS Course Structure</title> <link rel="stylesheet" href="smain.css"> <style type="text/css"> p:first-letter { color: #ff000f; font-size:xx-large } </style> </head> <body bgcolor="skyblue"> <h3><u>About Course Structure</u></h3> <p> This new course has been exclusively started for the faculty members who can get more knowledge and can easily conveyed to their students </p> <center><h3><u>Courses Offered</u></h3></center> <h2> <pre> M.E.Computer Science Engineering M.E.Embedded Systems M.E.Applied Electronics M.E.Communication Engineering M.E.PowerSystems 5

M.E.Structural Engineering M.E.Thermal Engineering </pre> </h2> </body> </html> <html> <head> <title>M.E(CSE) Fee Details</title> <style type="text/css">body{color:Black;}</style> </head> <body bgcolor=Skyblue> <center> <table border=1 > <caption><h4>Fee Details At The Time of Admission</h4></caption> <tr> <th>Sl.No</th> <th>Details</th> <th>Amount</th> <tr> <tr> <td>1</td> <td>Registration Fees</td> <td>600</td> <tr> <tr> <td>2</td> <td>Caution Deposit(Refundable)</td> <td>9,500</td> <tr> <td>3</td> <td>Provisional Certificate & Degree Certificate</td> <td>500</td> </tr> <tr> <td>4</td> <td>Cost of Regulation and Syllabus Book</td> <td>600</td> </tr> <td>5</td> <td>Examination Fees</td> <td>2,000</td> </tr> 6

<td>6</td> <td>Library and Internet Charges</td> <td>500</td> </tr> <td>7</td> <td>Tuition Fees</td> <td>18,000</td> </tr> <td>8</td> <td>Total</td> <td>31,700</td> </tr> </table> <br><br> <hr color="red" align="center" size=2> <table border=1 > <caption><h4>Fee Details - Payable Every Semester</h4></caption> <tr> <th>Sl.No</th> <th>Details</th> <th>Amount</th> <tr> <tr> <td>1</td> <td>Faculty Development Programme Fee</td> <td>2,500</td> <tr> <tr> <td>2</td> <td>Course Fee (per Credit)</td> <td>1,500</td> <tr> <tr> <td>3</td> <td>Examination Fee(per Subject)</td> <td>500</td> <tr> </table> </font> </center> <p> Note: Semester fee varies according to the number of credits offered in that semester. </p> </body> </html>

syllabus.html <html> <head> </head> <body bgcolor= skyblue> <center><h2>DEPARTMENT</h2></center> <h3> <ul> <a href="cse.pdf"><li>M.E.Computer Science Engineering</li></a><br><br> <a href="embeddedsystems.pdf"><li>M.E.Embedded Systems</li></a><br><br> <a href="appliedelectronics.pdf"><li>M.E.Applied Electronics</li></a><br><br> <a href="communication.pdf"><li>M.E.Communication Engineering</li></a><br><br> <a href="powersystems.pdf"><li>M.E.PowerSystems</li></a><br><br> <a href="structural.pdf"><li>M.E.Structural Engineering</li></a><br><br> <a href="thermal.pdf"><li>M.E.Thermal Engineering</li></a><br><br> </ul> </h3> </body> </html> exam.html <html> <head> <title>Exam Schedule</title> </head> <body bgcolor=skyblue> <center> <table border=2 > <caption><h2>Tentative Examination Schedule</h2></caption> <tr> <th>Sl.No</th> <th>Date</th> <th>Subject Name</th> <tr> <tr> <td>1</td> <td>05/06/2011</td> <td>Operating Systems Design</td> <tr> <tr> <td>2</td> <td>07/06/2011</td> <td>Database Technology</td> <tr> <td>3</td> 8

<td>09/06/2011</td> <td>Fundamentals of Pervasive Computing</td> </tr> <tr> <td>4</td> <td>11/06/2011</td> <td>Web Technology Laboratory</td> </tr> </table> <br><br> <hr color="darkred" align="center" size=8> </body> </html> contact.html <html> <head> <title>Address for Correspondence</title> </head> <body bgcolor=skyblue> <h1> <center><u>Address for Correspondence</u></center> <pre> The Director(Admissions) <pre> Centre for Academic Excellence <pre> Anna University of Technology ( BIT Campus) <pre> Tiruchirapalli 620 024 <pre> 0431-2407947 <br> <br> <pre> Email : director@tau.edu.in <pre> Web : www.tau.edu.in </h1> </body> </html>

Output: Home.html

Course.html

10

Fees.html

syllabus.html

11

exam.html

Regulation output Screen

12

Schedule Output Screen

Contact.html

Result: Thus the web site for FDP has been successfully created and verified.

13

Ex No: 2 Date:

EMBED THE MULTIMEDIA OBEJECTS

Aim: To develop a web page with multimedia objects of image, audio and video using java script with DHTML. Procedure: EMBEDDING IMAGES 1. Create the image.html with CSS for setting the images at the correct index position <style type="text/css"> #img1{position:absolute;left:"260px";top:"230px"} #img2{position:absolute;left:"290px";top:"260px"} #img3{position:absolute;left:"320px";top:"290px"} </style> 2. Using java script the image has been selected with their appropriate index position <script language="javascript"> function image1() { img1.sytle.zIndex=3; img2.sytle.zIndix=2; img3.sytle.zIndex=1; } 3. The three images are loaded into the web page with the tag <img id="img2" onClick="image2()"> src="gold petals.jpg" width="250px" height="300px"

The images can also be inserted using the following tag <object height=70% width=75% type='image/jpeg' data='waterfall.jpg'></object>

EMBEDDING AUDIO 14

4. The audio is loaded in the audio.html using the tag <object id="MPlyr" width=0 height=0 classid="CLSID:22D6F312-B0F611D0-94AB-0080C74C7E95"> <param name="filename" value = "SOUND1.WAV"> </object> 5. The script to load an audio file is written at the head part of audo.html as follows <script for="window" event="onload" language="javascript"> if(MPlyr.IsSoundCardEnabled()==true) { MPlr.Play() } else { aler("No sound capability available. click ok to continue") } </script> EMBEDDING VIDEO 6. The video is loaded in the video.html using <object id="MPlyr" classid="CLSID:22D6F312-B0F6-11D0-94AB0080C74C7E95"> <PARAM NAME= "FileName" value=" clock.avi"> <param name="autostart" value="-1"> </object> 7. The video file properties like start, pause and stop are set using <input type=button value="play"onclick="MPlyr.Play()"> <input type=button value="stop"onclick="MPlyr.Stop()"> <input type=button value="pause"onclick="MPlyr.Pause()"> 8. The video player properties like showDisplay and hideDisplay are set using <input type=button value="Hidedisplay"onclick="MPlyr.ShowDisPlay=false"> <input type=button value="Showdisplay"onclick="MPlyr.ShowDisPlay=true">

Program: 15

<html> <head> <title></title> <script id="clientEventHandlersJS" language="javascript"> <!-function DIV1_onclick() { } function Submit1_onclick() { var f,type; f=Text1.value; type=Text1.value; if(Select1.value==1) { document.write("<center><embed src='"+ f + ".mpeg' height=400 width=300></center>"); } else if(Select1.value==2) { document.write("<center><embed src='"+ f + ".mp3' height=200 width=200></center>"); } else if(Select1.value==3) { document.write("<center><object height='70%' width='75%' type='image/jpeg' data='"+ f + ".jpg'></object></center>"); } else { document.write("<center><embed src='"+ f + ".swf' height=200 width=200></center>"); } } //--> </script> </head> <body ms_positioning="GridLayout" bgcolor="pink"> <center><h1> Anna University of Technology<br>Tiruchirapalli - 620 024<br> <hr color='darkred' align='center' size=5></h1> <br><br><br> <b> <center><DIV id="DIV1" style="DISPLAY: inline; Z-INDEX: 101; LEFT: 150px; WIDTH: 136px; POSITION: absolute; TOP: 152px; HEIGHT: 24px" 16

ms_positioning="FlowLayout" language="javascript" onclick="return DIV1_onclick()"><h4> Enter the File Name</DIV> <br> <br> <INPUT id="Text1" style="Z-INDEX: 102; LEFT: 320px; WIDTH: 128px; POSITION: absolute; TOP: 152px; HEIGHT: 24px" type="text" size="14" name="Text1"><INPUT id="Submit1" style="ZINDEX: 103; LEFT: 304px; WIDTH: 100px; POSITION: absolute; TOP: 248px; HEIGHT: 24px" type="submit" value="Launch Page" name="Submit1" language="javascript" onclick="return Submit1_onclick()"> <DIV style="DISPLAY: inline; Z-INDEX: 104; LEFT: 150px; WIDTH: 136px; POSITION: absolute; TOP: 200px; HEIGHT: 24px" ms_positioning="FlowLayout">Enter The Type</DIV> <SELECT id="Select1" style="Z-INDEX: 105; LEFT: 328px; POSITION: absolute; TOP: 200px; HEIGHT: 24px" name="Select1"> <OPTION value="1" selected>mpeg</OPTION> <OPTION value="2">mp3</OPTION> <OPTION value="3">JPEG/GIF</OPTION> <OPTION value="4">Flash</OPTION> </SELECT> </h4> </b> </center> </body> </html>

Output:

17

Result: Thus the web page with multimedia objects has been created and verified successfully. Ex No: 3 Date: XML DOCUMENT FOR THE STUDENTS OF AUT- T WITH DTD/SCHEMA 18

Aim: To develop an XML Document for the students of Anna University of Technology Tiruchirapalli and validate the same using DTD/SCHEMA. DTD The purpose of a DTD is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements. A DTD can be declared inline in the XML document, or as an external reference. DTD is a set of rules that defines what tag appear in a XML document, so that viewers of an XML document know what all the tags mean. The building blocks of XML documents XML documents (and HTML documents) are made up by the following building blocks : Elements, Tags, Attributes, Entities, PCDATA, and CDATA Elements Elements are the main building blocks of both XML and HTML documents. Tags Tags are used to markup elements. Attributes Attributes provide extra information about elements. PCDATA PCDATA means parsed character data CDATA CDATA also means character data. CDATA is text that will NOT be parsed by a parser Entities Entities as variables used to define common text. Entity references are references to entities. <!ELEMENT [element_name] ([names of allowed elements])> eg: <!ELEMENT sno (#PCDATA)>

SCHEMA XML Schema is an XML-based alternative to DTD. An XML schema describes the structure of an XML document. The XML Schema language is also referred to as XML Schema Definition

19

(XSD).XML Schema became a W3C Recommendation 02. May 2001. The <schema> element is the root element of every XML Schema. The following fragment: xmlns:xs="http://www.w3.org/2001/XMLSchema" indicates that the elements and data types used in the schema come from the "http://www.w3.org/2001/XMLSchema" namespace. It also specifies that the elements and data types that come from the "http://www.w3.org/2001/XMLSchema" namespace should be prefixed with xs: Procedure: 1. Design a General structure of the Student i.e., the structure of the Student Element. STUDENT (batchno,name,regno,branch,gender,address,sports,qualification); 2. Create a DTD file which should check the XML document and tell whether the XML document has followed the syntax given in the DTD or not. 3. If not suitable changes should be made in the XML document i.e., the application can use a standard DTD to verify that the data received from the outside world is valid or not. 4. The DTD File is embedded in the XML file using the following code External DTD: <!DOCTYPE note SYSTEM "student.dtd"> where student.dtd is the name of the DTD file. The tags developed in the DTD can be used here for inserting the fields.

Program: 3 a) XML Document for the Students Details and DTD with DSS Student.css student 20

{ background.color:#FFFABC; width=100%; } record { display:block; color:BLACK; font.size:20pt; } sno { display:block; color:GREEN; font.size:15pt; } sname { display:block; color:BLUE; font.size:15pt; } dob { display:block; color:VIOLET; font.size:15pt; } address { display:block; color:RED; font.size:15pt; } m1 { display:block; color:INDIGO; font.size:15pt; } m2 { display:block; color:ROSE; font.size:15pt; } m3 { display:block; color:RED; font.size:15pt; 21

} student.dtd <?xml version="1.0"?> <!ELEMENT students (student+)> <!ELEMENT student (record,sno,sname,dob,address,m1,m2,m3)> <!ELEMENT record (#PCDATA)> <!ELEMENT sno (#PCDATA)> <!ELEMENT sname (#PCDATA)> <!ELEMENT dob (#PCDATA)> <!ELEMENT address (#PCDATA)> <!ELEMENT m1 (#PCDATA)> <!ELEMENT m2 (#PCDATA)> <!ELEMENT m3 (#PCDATA)> student.xml ?xml version="1.0"?> <?xml-stylesheet type="text/css" href="student.css"?> <!DOCTYPE student SYSTEM "student.dtd"> <students> <student> <record>RECORD 1</record> <sno>01110901001</sno> <sname>ARUN BALAJI</sname> <dob>04/01/1983</dob> <address>Trichy</address> <m1>80</m1> <m2>85</m2> <m3>90</m3> </student> <student> <record>RECORD 2</record> <sno>01110901002</sno> <sname>ARUNABARATH</sname> <dob>04/02/1982</dob> <address>Chennai</address> <m1>90</m1> <m2>80</m2> <m3>95</m3> </student> </students> Output:

22

3 b) XML Document for the Students Details of AUT- T using XML with XSL student.xsl <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body bgcolor="orange"> <center><h1>Anna University of Technology</h1> <h2>Tiruchirapalli</h2> M.E (Modular Based Credit Banking System) <h3>Student Details</h3> <table border="5" bgcolor="lightgreen"> <tr> <th>Register Number</th> <th>Name</th> <th>Department</th> <th>Contact Address</th> <th>Contact Number</th> </tr> <xsl:for-each select="STUDENT/CD"> <tr> <td><xsl:value-of select="REGISTERNO"/></td> <td><xsl:value-of select="NAME"/></td> <td><center><xsl:value-of select="DEPARTMENT"/></center></td> <td><xsl:value-of select="CONTACTADDRESS"/></td> <td><xsl:value-of select="CONTACTNUMBER"/></td> </tr> 23

</xsl:for-each> </table></center> </body> </html> </xsl:template> </xsl:stylesheet> student.xml <?xml version="1.0" encoding="ISO8859-1" ?> <?xml-stylesheet type="text/xsl" href="STUDENT.xsl"?> <STUDENT> <CD> <REGISTERNO>01110901001</REGISTERNO> <NAME>GEETHA</NAME> <DEPARTMENT>CSE</DEPARTMENT> <CONTACTADDRESS>41/A KAMARAJAR STREET,TIRUCHY</CONTACTADDRESS> <CONTACTNUMBER>9995487548</CONTACTNUMBER> </CD> <CD> <REGISTERNO>01110901002</REGISTERNO> <NAME>KARTHIK</NAME> <DEPARTMENT>IT</DEPARTMENT> <CONTACTADDRESS>5,SOUTH STREET,TIRUCHY</CONTACTADDRESS> <CONTACTNUMBER>9854227548</CONTACTNUMBER> </CD> <CD> <REGISTERNO>01110901003</REGISTERNO> <NAME>MALA</NAME> <DEPARTMENT>IT</DEPARTMENT> <CONTACTADDRESS>12,WEST STREET,TIRUCHY</CONTACTADDRESS> <CONTACTNUMBER>9847852369</CONTACTNUMBER> </CD> <CD> <REGISTERNO>01110901004</REGISTERNO> <NAME>MEENAKSHI</NAME> <DEPARTMENT>IT</DEPARTMENT> <CONTACTADDRESS>6,KK NAGAR,TIRUCHY</CONTACTADDRESS> <CONTACTNUMBER>9258963549</CONTACTNUMBER> </CD> </STUDENT>

Output:

24

Result: Thus the XML Document for the students of Anna University of Technology, Tiruchirapalli has been created and validated using DTD/SCHEMA

Ex No: 4 Date:

A XML PARSER TO RETRIEVE STUDENT DETAILS USING DOM 25

Aim: To develop an XML Parser using DOM to retrieve student details. XML DOM The XML DOM defines a standard for accessing and manipulating XML. The w3c document object model is a platform neutral interfcae that allows progrmas and scripts to dynamically access abd update the content, structure and style of a document. The XML DOM views an XML document as a tree-structure. The tree structure is called a node-tree. All nodes can be accessed through the tree. Their contents can be modified or deleted, and new elements can be created. The terms parent, child, and sibling are used to describe the relationships. Parent nodes have children. Children on the same level are called siblings (brothers or sisters). In a node tree, the top node is called the root 1 2 3 4 Every node, except the root, has exactly one parent node A node can have any number of children A leaf is a node with no children Siblings are nodes with the same parent

Because the XML data is structured in a tree form, it can be traversed without knowing the exact structure of the tree and without knowing the type of data contained within.

Procedure: i. Create an XML Document, which contains the details of the students. 26

ii. Embed

the

<xsl:stylesheet

xmlns:xsl=

http://www.w3.org/TR/WD-xsl>

and

<xsl:template match=/>tags top of the HTML document. iii. Create a HTML page with suitable tags, which will display the headings of the given student. iv. A suitable logic is developed by using <xsl:for-each select=STUDENT/BIO> and </xsl:for-each> to display the contents from the XML document to the HTML document. Program: studentbio.xml <?xml version="1.0" ?> <?xml-stylesheet type ="text/xsl" href="biodata.xsl" ?> <STUDENT> <BIO> <NAME> ANAND S.</NAME> <FATHERSNAME> SIVARAMAN K. </FATHERSNAME> <DOB> 02/05/1987 </DOB> <ADDRESS> 1, FIRST MAIN ROAD, TOLGATE, TIRUCHIRAPPALLI</ADDRESS> <EMAIL> anand_s@gmail.com </EMAIL> <PHONE> 9976564523</PHONE> <DEPARTMENT> CSE </DEPARTMENT> </BIO> <BIO> <NAME> GOWRI A.</NAME> <FATHERSNAME> ANBU M. </FATHERSNAME> <DOB> 12/11/1985 </DOB> <ADDRESS> 12, PONNAPAR STREET, DINDIGUL</ADDRESS> <EMAIL> gowri1985@gmail.com </EMAIL> <PHONE> 9997099009</PHONE> <DEPARTMENT> ES </DEPARTMENT> </BIO> <BIO> <NAME> SUBRAMANIYAN D.</NAME> <FATHERSNAME> BALAN M. </FATHERSNAME> <DOB> 02/05/1987 </DOB> <ADDRESS> 12, TVK STREET, ARIALUR</ADDRESS> <EMAIL> subramanid@yahoo.com </EMAIL> <PHONE> 9787563412</PHONE> 27

<DEPARTMENT> PS </DEPARTMENT> </BIO> </STUDENT> biodata.xsl <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <html> <body bgcolor="#DDaabb"> <center> <h1> ANNA UNIVERSITY OF TECHNOLOGY, TIRUCHIRAPPALLI </h1> <h2> STUDENT BIODATA </h2> <h3> COURSE: M.E. THROUGH MBCBS </h3> <table border="1" bgcolor="#88bbff" bordercolor="#000000a0"> <tr> <th> NAME </th> <th> FATHER'S NAME </th> <th> DATE OF BIRTH </th> <th> ADDRESS</th> <th> PHONE</th> <th> DEPARTMENT </th> </tr> <xsl:for-each select="STUDENT/BIO"> <tr> <td> <xsl:value-of select="NAME"/> </td> <td> <xsl:value-of select="FATHERSNAME"/> </td> <td> <xsl:value-of select="DOB"/> </td> <td> <xsl:value-of select="ADDRESS"/> </td> <td> <xsl:value-of select="PHONE"/> </td> <td> <xsl:value-of select="DEPARTMENT"/> </td> </tr> </xsl:for-each> </table> </center> </body> </html> </xsl:template> </xsl:stylesheet> Output:

28

Result: Thus an XML parser is developed using DOM to retrieve the student information.

Ex No: 5 Date:

A PHP PROGRAM TO DISPLAY THE DETAILS OF FACULTY 29

Aim:
To write PHP program to display the details of Faculty with their expertise. Procedure: i. ii. iii. iv. v. Create a database in MySQL RDBMS which contains the details of the Faculty. Give the code $database=mysql_connect("localhost","root","") to connect to the MySql DB. Build query using SELECT SQL statement. Execute the query. Display all records in the table using the loop statement along with display formats.

Program: Facultydata.php <html xmlns="http://www.w3.org"> <head> <title> FACULTY NAME LIST</title> </head> <body style="font-family:arial"> <?php //connect to MYSQL if(!($database=mysql_connect("localhost","root",""))) die("could not connect to database"); // open faculty name list database if(!mysql_select_db("fac", $database)) die("could not open faculty namelist"); $result=mysql_query("SELECT * from facu"); ?> <center> <h3 style="color:blue"> NAMES OF THE FACULTY WITH THIER EXPERTISE </h3> <table border=1> <tr> <td> NAME </td> <td> PHONE </td> <td> E-MAIL ID </td> <td> EXPERTISE </td> 30

</tr> <?php while($info = mysql_fetch_array( $result )) { Print "<tr>"; Print "<td>".$info['Name'] . "</td> "; Print "<td>".$info['Phone'] . " </td>"; Print "<td>".$info['Email'] . " </td>"; Print "<td>".$info['Expertise'] . " </td></tr>"; } Print "</table>"; mysql_close($database); ?> </center> </body> </html>

Output: 31

Result Thus the PHP program to display the details of Faculty with their expertise was developed. Ex No: 6 Date: A CHAT APPLICATION USING SOCKETS

32

Aim: To write a Java program to implement a Chat application using sockets. Procedure: Server side 1. Import the necessary header files. import java.net.*; 2. Bind the server with the specified port using ServerSocket. ServerSocket ss=new ServerSocket(5000); 3. Listening for the clients to connect to the server. Socket soc=ss.accept(); 4. Repeatedly chat with the client using the following format. Out the data to be sent to the client. And In the data send by the client. DataInputStream dis=new DataInputStream(System.in); DataInputStream sdis=new DataInputStream(soc.getInputStream()); PrintStream ps=new PrintStream(soc.getOutputStream()); String s1=dis.readLine(); ps.println(s1); 5. Close the sockets Soc.close(); Client Side 1. Import the necessary header files. import java.net.*; 2. Connect the client with the specified port using Socket. Socket s=new Socket(cse21,5000);

3. Repeatedly chat with the server using the following format. Out the data to be sent to the server. And In the data send by the server. DataInputStream dis=new DataInputStream(System.in); DataInputStream sdis=new DataInputStream(soc.getInputStream()); 33

PrintStream ps=new PrintStream(soc.getOutputStream()); String s1=dis.readLine(); ps.println(s1); 4. Close the sockets Soc.close();

Program: //server.java import java.net.*; import java.io.*; 34

public class server { public static void main(String[ ] args) throws Exception { ServerSocket ss=new ServerSocket(5000); Socket soc=ss.accept(); DataInputStream dis=new DataInputStream(System.in); DataInputStream sdis=new DataInputStream(soc.getInputStream()); PrintStream ps=new PrintStream(soc.getOutputStream()); while(true) { String s1=sdis.readLine(); System.out.print("\nClient:"+s1); if(s1.equals("end")) { soc.close(); break; } else { System.out.print("\nServer:"); String s2=dis.readLine(); ps.println(s2); if(s2.equals("end")) { soc.close(); break; } } } //Client.java import java.net.*; import java.io.*; } }

35

public class client { public static void main(String [] args) throws Exception { Socket soc=new Socket("localhost",5000); DataInputStream dis=new DataInputStream(System.in); DataInputStream sdis=new DataInputStream(soc.getInputStream()); PrintStream ps=new PrintStream(soc.getOutputStream()); while(true) { System.out.print("\nClient:"); String s1=dis.readLine(); ps.println(s1); if(s1.equals("end")) { soc.close(); break; } else { String s2=sdis.readLine(); System.out.print("\nServer:"+s2); if(s2.equals("end")) { soc.close(); break; } } } } } Output:

36

Result: Thus the program for chat application using sockets has been completed and verified.

37

Ex No: 7 Date: Aim:

AN I/O STREAMING MODEL

To write a Java program to illustrate I/O streaming using FTP. Procedure: Java performs I/O through streams. A Stream is an abstraction that either produces or consumes information. Reading Console Input 1. Import the necessary header files. import java.io.*; 2. Reading Console Input The console input is accomplished by reading through System.in. To obtain a character based stream that is attached to the console, wrap System.in a BufferedReader object. InputStream is = soc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); 3. Writing Console Output PrintStream is an output stream derived from OutputStream, it also implements the low level method write() Void write(int byteval); 4. Reading and Writing Files In java, all files are byte-oriented and java provides methods to read and write bytes from and to a file.File f = new File("a.txt"); FileInputStream fis = new FileInputStream(f); OutputStream os = soc.getOutputStream(); PrintStream ps = new PrintStream(os); String data; while((data=br.readLine())!=null) ps.println(data); 5. Close all the File Input and Outstreams.

38

Program: //ftpserver.java import java.io.*; import java.net.*; public class FTPServer{ public static void main(String []args)throws Exception{ System.out.println("FTP Server started..."); ServerSocket ss = new ServerSocket(5000); Socket soc = ss.accept(); File f = new File("a.txt"); FileInputStream fis = new FileInputStream(f); InputStreamReader isr = new InputStreamReader(fis); BufferedReader br = new BufferedReader(isr); OutputStream os = soc.getOutputStream(); PrintStream ps = new PrintStream(os); String data; while((data=br.readLine())!=null) ps.println(data); System.out.println("File Transfer Completed..."); br.close(); ps.close(); soc.close(); } } //ftpclient.java import java.io.*; import java.net.*; public class FTPClient{ public static void main(String []args)throws Exception{ Socket soc = new Socket("localhost",5000); File f = new File("b.txt"); FileOutputStream fos = new FileOutputStream(f); PrintStream ps = new PrintStream(fos);

39

InputStream is = soc.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String data; int i=1; while((data = br.readLine())!=null) { ps.println(data); System.out.println(data); } System.out.println("File Transfer Completed..."); br.close(); ps.close(); soc.close(); } } //charsetream.java import java.io.*; class charstream { public static void main(String args[]) throws IOException { BufferedReader br1=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the file name:"); String fname=br1.readLine(); FileWriter fo=new FileWriter(fname); BufferedReader br2=new BufferedReader(new InputStreamReader(System.in)); String s; System.out.println("enter the line of text here"); System.out.flush(); s=br2.readLine(); for(int i=0;i<s.length();i++) fo.write(s.charAt(i)); fo.close(); FileReader fi=new FileReader(fname); int read; System.out.println("\n content in the"+fname); while((read=fi.read())!=-1) System.out.print((char)read); fi.close(); } }

40

Output:

Result: Thus the program for illustrating Streams has been completed and verified.

Ex No: 8
Date: AN IMPLEMENTATION OF PING COMMAND

Aim: To develop a program in java for implementing ping command. Procedure: Ping is a computer network tool used to test whether a particular host is reachable across an IP network; it is also used to self-test the network interface cord of the computer. It works by sending ICMP echo request packets to the target host and listening for ICMP echo response replies. Ping estimates the round-trip time, generally in milliseconds, and records any packet loss, and prints a statistical summary when finished. 41

1. Import the necessary java files. 2. Using command line argument the remote machine IP address is assigned to the variable ip as follows. String ip = args[0]; 3. Using the following statements the ping command of the remote machine is initiated at the current running machine. String pingCmd = "ping " + ip; Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); 4. The status of remote machine has been displayed at the current machine using the following statements. BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); 5. If there is a connection with the system, it sends the number of bytes received or else it displays "Request timed out"

Program: import java.net.*; import java.io.*; import java.util.*; public class Ping { public static void main(String[] args) { String ip = args[0]; String pingResult = ""; String pingCmd = "ping " + ip; try { 42

Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); //pingResult += inputLine; } in.close(); }//try catch (IOException e) { System.out.println(e); } } }

Output:

43

Result: Thus the ping command has been successfully implemented and verified.

Ex No: 9 Date:

A SIMULATION OF SMTP

Aim: To develop a program in Java to simulate SMTP. SMTP The Simple Mail transfer Protocol is used to create mail like a postal mail. It has both the sender and the receiver address. At the Sender side, The message header consists of sender address, receiver address and subject field. And the body field contains the actual information to be sent. In the receiver side, The email system periodically checks the mailboxes. If a user has mail, it informs the user with a notice. If the user is ready to read the mail, a list is displayed in which each line contains a summary of the information about a particular message in the mailbox. Summary contains the sender mail address, the subject, and time the mail was sent or received. SMTP is a push protocol; it pushes the message from the sender to the receiver even if the receiver does not want it.

Procedure:
1. An SMTP server has been designed to send an email to the concerned recipient using the SMTP mail format

44

2. The email system needs information like a. SMTP Server Name b. Sender Email ID c. Receiver Email Id 3. A Socket connection has been created in the following format Socket s = new Socket(smtpserver, 25); 4. The email has been sent to recipient using the format of

HELO recipient
250 Ok (from recipient) MAIL FROM: abc@yahoo.com 250 abc@yahoo.com Sender Ok RCPT TO: xyz@yahoo.com 250 Ok DATA Welcome . (period to stop the transfer) 5. Using the socket connection the data has been sent to the recipient machine.

Program: import java.awt.*; import java.awt.event.*; //import java.util.*; import java.net.*; import java.io.*; import java.applet.*; //<applet code="SMTP.class" height=200 width=200></applet> public class SMTP extends Applet implements ActionListener { private BufferedReader in; private PrintWriter out; private TextField from, to , server; private TextArea message, response; private Button send; 45

public void init() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; gbc.weighty = 0; addUsingGBL(new Label(" SMTP SERVER: "), gbc, 0, 0, 1, 1); addUsingGBL(new Label(" FROM: "), gbc, 0, 1, 1, 1); addUsingGBL(new Label(" TO: "), gbc, 0, 2, 1, 1); server = new TextField("localhost"); from = new TextField("a@b.com"); to = new TextField("jinihou@yahoo.com"); addUsingGBL(server, gbc, 1, 0, 2, 1); addUsingGBL(from, gbc, 1, 1, 2, 1); addUsingGBL(to, gbc, 1, 2, 2, 1); addUsingGBL(new Label(""), gbc, 0, 3, 1, 1); send = new Button("SEND EMAIL"); addUsingGBL(send, gbc, 1, 4, 1, 1); send.addActionListener(this); addUsingGBL(new Label(""), gbc, 0, 5, 1, 1); message = new TextArea(""); response = new TextArea(""); addUsingGBL(message, gbc, 0, 6, 3, 1); addUsingGBL(response, gbc, 0, 7, 3, 1); } void addUsingGBL(Component component, GridBagConstraints gbc, int x, int y, int w, int h) { gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = w; gbc.gridheight = h; add(component, gbc); } public void actionPerformed(ActionEvent evt) { String str = evt.getActionCommand(); if (str.equals("SEND EMAIL")) { 46

sendMail(); } } public void sendMail() { try { Socket s = new Socket(server.getText(), 25); out = new PrintWriter(s.getOutputStream()); in = new BufferedReader(new InputStreamReader(s.getInputStream())); String hostName = InetAddress.getLocalHost().getHostName(); send(null); send("HELO " + hostName); send("MAIL FROM: " + from.getText()); send("RCPT TO: " + to.getText()); send("DATA"); out.println(message.getText()); send("."); s.close(); } catch (IOException exception) { response.append("Error: " + exception); } } public void send(String s) throws IOException { if (s != null) { response.append(s + "\n"); out.println(s); out.flush(); } String line; if ((line = in.readLine()) != null) response.append(line + "\n"); } public static void main(String[] args) { SMTP a = new SMTP(); a.init(); a.start(); Frame f= new Frame("SEND MAIL"); f.addWindowListener(new java.awt.event.WindowAdapter(){ public void windowClosing(java.awt.event.WindowEvent e) { 47

System.exit(0); };}); f.add("Center", a); f.pack(); f.setSize(360,500); f.setLocation(100,100); f.show(); }}

Output:

48

Result: Thus SMTP mail service is simulated with the appropriate format.

Ex No: 10 Date:

A SIMULATION OF HTTP

49

Aim: To implement the http protocol in java. Procedure: In this program, a browser has been developed as an HTTP client and a web server as an HTTP server. An HTTP client sends a request to the server followed by request headers and a blank line. It then reads the status line, response headers, and the requested file from the server. An HTTP server reads the request from the client, header details and in some cases additional data. It sends a status line followed by headers and the requested resource, if any. Browser.java 1. Import all the necessary files. 2. The user is allowed to pass the server port number on which it will run as the webserver program and the connection with the webserver has been established using the following statements in the browser. int port = Integer.parseInt(args[1]); Socket server = new Socket(args[0],port); System.out.println("Connected to host" + server.getInetAddress()); 3. The path to the resource, (/~artg/TryURL.java) is set by sending the host address and port in a separate Host header as follows. PrintWriter toServer = new PrintWriter(server.getOutputStream(),true); toServer.println("GET"+args[2]+"HTTP/1.0"); toServer.println("Host:"+args[0]+':'+args[1]); toServer.println(); 4. The status line and headers sent by the server & looking for the blank line that signals the end of the headers and the start of the file we requested has been initiated by the following statements. while(!(s=fromServer.readLine()).equals("")); 5. The following loop reads the file we requested from the server, displaying it in the command window. while((s=fromServer.readLine())!= null) System.out.println(s); WebServer.java 1. Import the necessary files. 50

2. Read the first line from the client to find the method and the identifier for the resource. s = fromClient.readLine(); 3. Using StringTokenizer, the method and parts of the request has been identified StringTokenizer tokens = new StringTokenizer(s); 4. If the request method is anything other than GET, the server sends a status line with a code of 501 to indicate that the method can not implemented. if(!(tokens.nextToken()).equals("GET")){ toClient.println("HTTP/1.0 501 Not implemented"); toClient.println(); 5. The file name after GET is separated by a blank in the request of the client. It has been saved before reading the next line from the client, which will overwrite the string s as follows. String filename = tokens.nextToken(); 6. By the following statements, we can read and ignore any request headers sent by the client, looking for the blank line that separates the request and hreaders form any data the client might send. while(!(s = fromClient.readLine()).equals("")); 7. If file cannot be found or another error occurs, the exception thrown will cause control to jump to the catch clause and the server to terminate by the following statements. BufferedReader file = new BufferedReader(new FileReader(filename)); 8. Having created the file to send, the server sends a status line with code 200 meaning OK. And follows with one header describing the content type to help the client to display it. toClient.println("HTTP/1.0 200 OK"); toClient.println("content type: text/plain"); 9. The following loop sends the file to the client. while((s=file.readLine())!=null) toClient.println(s); Program: //Browser.java

51

import java.net.*; import java.io.*; public class Browser{ public static void main(String[] args){ String s; if(args.length!=3){ System.out.println("Usage: java Browser host port file"); System.exit(1); } try{ int port = Integer.parseInt(args[1]); Socket server = new Socket(args[0],port); System.out.println("Connected to host" + server.getInetAddress()); BufferedReader fromServer = new BufferedReader(new InputStreamReader(server.getInputStream())); PrintWriter toServer = new PrintWriter(server.getOutputStream(),true); toServer.println("GET"+args[2]+"HTTP/1.0"); toServer.println("Host:"+args[0]+':'+args[1]); toServer.println(); while(!(s=fromServer.readLine()).equals("")); while((s=fromServer.readLine())!= null) System.out.println(s); fromServer.close(); toServer.close(); server.close(); } catch(Exception e) { e.printStackTrace(); } } } //Webserver.java import java.net.*; import java.io.*; import java.util.StringTokenizer; public class Webserver{ public static void main(String[] args){ String s; try{ ServerSocket server = new ServerSocket(Integer.parseInt(args[0])); Socket client = server.accept(); System.out.println("very simple web server connected on port"+args[0]); BufferedReader fromClient = new BufferedReader(new InputStreamReader(client.getInputStream())); 52

PrintWriter toClient = new PrintWriter(client.getOutputStream(),true); s = fromClient.readLine(); StringTokenizer tokens = new StringTokenizer(s); if(!(tokens.nextToken()).equals("GET")){ toClient.println("HTTP/1.0 501 Not implemented"); toClient.println(); } else { String filename = tokens.nextToken(); while(!(s = fromClient.readLine()).equals("")); BufferedReader file = new BufferedReader(new FileReader(filename)); toClient.println("HTTP/1.0 200 OK"); toClient.println("content type: text/plain"); toClient.println(); while((s=file.readLine())!=null) toClient.println(s); file.close(); } fromClient.close(); toClient.close(); client.close(); } catch(Exception e) { e.printStackTrace(); }}}

Output:

53

Result: Thus the implementation of HTTP protocol in java is successfully completed and verified.

Ex No: 11 Date:

DOWNLOADING AN IMAGE FILE USING RMI 54

Aim To develop a java program to download an image using Remote Method Invocation. Introduction: A distributed application is an application whose is distributed across multiple networked computers. Distributed architecture is based on the three tier architecture application development, where the front and namely the user interface is on one network and business rules and the database on a different network. The models for developing distributed applications that exist in the industry today are DCOM, RMI and CORBA. The distributed object model used by java allows objects in one JVM and this is known as Remote Method Invocation. General RMI Architecture: 1. The server must first bind the name to the registry. 2. The client lookup the server name in the registry to establish remote references. 3. The stub serializes the parameters to skeleton; the skeleton invokes the remote method and serializes the result back to the stub. Procedure to develop a RMI system: Step 1: Defining remote interface to create a RMI application, the first step is defining of a remote interface between the Client and Server objects. The Remote interface must have the following properties: The interface must be public. The interface must extend the interface.java.rmi.Remote. Every methods declared in the interface must throw java.rmi.RemoteException. Other exceptions may also be thrown. Step 2: Develop the Implementation class. Create the implementation class by extending java.rmi.server.UnicastRemoteObject. UnicastRemoteObject.exportObject(new ServerRMI,port) this can be used in case the server already extends some other class and we want that class to be the server class. The implementation class needs to override the remote interface methods. The java.rmi.server Package: This package implements several interfaces and classes that support both client and server aspects of RMI like a class implantation of the remote interface, client stub, server skeleton and so on. Step 3: Develop the server program. The server must bind its name to the name registry. The client will look up the server name use java.rmi.Naming class to bind the server name to registry. Step 4: Develop the client program. 55

In order for the client object to invoke methods on the server, it must first look up the name of the server object in the registry. Use the java.rmi.Naming class to lookup the server name. Use the java.rmi.Naming class to lookup the servername. The server name is specified as URL in the format (rmi://host:port/name). Default RMI port is 1099. The name specified in the URL must exactly match the name with which the server object has bound to the registry. The remote method invocation is programmed using the remote interface reference_name.function_name. Step 5: Compiling of all the source files. Step 6: Generating stubs and skeleton. Now the stub and skeleton need to be generated using rmic (rmi compiler) >rmic implementation file Roles of SKELETON: Lives on server Receiver requests stub Talks to true remote object Delivers response to stub Roles of STUB: Lives on client Responsible for initiating a call Client proxy of the remote object Returns the result back to client Step 7: Starting the RMI registry The rmiregistry must be stated using start rmiregistry. This step needs to be done before the server program starts as the implementation object has to be registered. Step 8: Run the server program Once the registry is started, the server can be started and will be able to store itself in the register. >java ServerRMI Step 9: Run the client program >java ClientRMI The client program can now access the implementation program which is at the server. The file is downloaded in the client system. For the client it seems as if the function call is on the same machine.

Program: 56

// dInterface.java import java.rmi.*; public interface dInterface extends Remote { public byte[] download(String filename) throws RemoteException; } // dImplementation.java import java.rmi.*; import java.rmi.server.*; import java.io.*; public class dImplementation extends UnicastRemoteObject implements dInterface { public dImplementation() throws Exception { super(); } public byte[] download(String filename) { try { FileInputStream fis = new FileInputStream(filename); byte[] bytearray = new byte[fis.available()]; fis.read(bytearray,0,bytearray.length); return bytearray; } catch (Exception e) { return null; } } }

// ServerRMI.java import java.rmi.*; public class ServerRMI { public static void main(String args[]) throws Exception { dImplementation obj= new dImplementation(); Naming.rebind("jj",obj); } } // ClientRMI.java 57

import java.rmi.*; import java.io.*; public class ClientRMI { public static void main(String args[]) throws Exception { String serverurl="rmi://localhost/jj"; dInterface dintf=(dInterface) Naming.lookup(serverurl); byte[] b=dintf.download(args[0]); FileOutputStream fos=new FileOutputStream(args[0]); fos.write(b); } }

Output:

58

Result Thus the program to download an image using Remote Method Invocation is successfully developed and is verified. Ex No: 12 Date: IMPLEMENTING ARITHMETIC CALCULATION USING RMI-IIOP 59

Aim To simulate the RMI-IIOP for implementing arithmetic operation using RMI-IIOP. Procedure For implementing this RMI-IIOP, 4 files are required namely i) ii) iii) iv) ArithInterface.java ArithImpl.java ArithClient.java ArithServer.java

ArithInterfcae.java i) ii) iii) The remote interface must be declared public. The data type of any remote object that is passed as an argument or return value must be declared as remote interface type. Declare the methods for performing operations like add(), sub() and mult().
//ArithInterface.java import java.rmi.Remote; public interface ArithInterface extends java.rmi.Remote { }

ArithImpl.java i) ii) iii) Declare the implementation class with atleast one remote interface. Define the constructor for the remote object. Provide implementations for the methods that can be invoked remotely.

ArithServer.java A Server class is the class which has the main method that creates an instance of the remote object implementation and binds that instance to a name in the Naming Service. The class that contains this main method could be the implementation class itself. ArithClient.java The Client application gets a reference to the remote object implementation from the 60

Naming Service using Java Naming and Directory Interface(JNDI) calls. i) The Naming.lookup method takes java.lang.String value representing the name of the object to look up. Compilation 1. Compile the remote object implementation. 2. Use rmic to generate stubs and skeletons. 3. Compile the source files javac *.java rmic iiop ArithImpl start orbd ORBIntialPort 1050 4. Start the Server java -classpath -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://localhost:1050 HelloServer 5. Start the client using the same syntax above. Program: //Arithserver.java import javax.naming.*; public class ArithServer { public static void main(String[] args) { try { // Step 1: Instantiate the Hello servant ArithImpl arithRef = new ArithImpl(); // Step 2: Publish the reference in the Naming Service // using JNDI API Context initialNamingContext = new InitialContext(); initialNamingContext.rebind("ArithService", arithRef ); System.out.println("Hello Server: Ready..."); .

} catch (Exception e) { System.out.println("Trouble: " + e); e.printStackTrace(); } } } // Arithclient.java import java.rmi.*; import java.net.*; import javax.rmi.*; 61

import java.util.Vector; import javax.naming.*; public class ArithClient { public static void main( String args[] ) { Context ic; Object objref; ArithInterface hi; try { ic = new InitialContext(); // STEP 1: Get the Object reference from the Name Service // using JNDI call. objref = ic.lookup("ArithService"); System.out.println("Client: Obtained a ref. to Arith server."); // STEP 2: Narrow the object reference to the concrete type and // invoke the method. hi = (ArithInterface) PortableRemoteObject.narrow( objref, ArithInterface.class); int result; result=hi.add(5,10); System.out.println("Add result is = "+result); result=hi.sub(5,10); System.out.println("Sub result is = "+result); result=hi.mul(5,10); System.out.println("Mul result is = "+result); } catch( Exception e ) { System.err.println( "Exception " + e + "Caught" ); e.printStackTrace( ); return; } } }

//ArithImpl.java import java.rmi.*; import javax.rmi.*; 62

public class ArithImpl extends PortableRemoteObject implements ArithInterface { public ArithImpl() throws RemoteException { super(); } public int add(int x,int y)throws RemoteException { return (x+y); } public int sub(int x,int y)throws RemoteException { return (x-y); } public int mul(int x,int y)throws RemoteException { return (x*y); } } //Arithinterface.java import java.rmi.*; public interface ArithInterface extends Remote { public int add(int x,int y)throws RemoteException; public int sub(int x,int y)throws RemoteException; public int mul(int x,int y)throws RemoteException; }

Output:

63

Result Thus the program to implement Arithmetic Operations using RMI-IIOP is successfully developed and is verified.

64