Professional Documents
Culture Documents
SEMESTER-V
(Journal)
University of Mumbai
University of Mumbai
Certificate
This is to certify that ________________________ of T.Y. M.C.A. Semester-V has completed
the specified term work in the subject of WIRELESS TECHNOLOGY AND MOBILE
COMPUTING satisfactorily within this institute as laid down by University of Mumbai during
the academic year 2016-2017
MCA Co-ordinator
(Prof. Anjali Kulkarni)
Examiner
University of Mumbai
Practical Description
Page No.
13
19
5.
10
22
24
28
35
40
47
Date
Sign
g.fillRect(0,0,width,height);
g.setFont(Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_ITALIC,Font.SIZE_SMALL));
g.setColor(fcol);
g.drawString(str2,4,4,Graphics.TOP|Graphics.LEFT);
break;
case 6:
g.setColor(bcol);
g.fillRect(0,0,width,height);
g.setFont(Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_ITALIC,Font.SIZE_LARGE));
g.setColor(fcol);
g.drawString(str2,4,4,Graphics.TOP|Graphics.LEFT);
break;
case 7:
g.setColor(bcol);
g.fillRect(0,0,width,height);
g.setFont(Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_PLAIN,Font.SIZE_SMALL));
g.setColor(fcol);
g.drawString(str2,4,4,Graphics.TOP|Graphics.LEFT);
break;
case 8:
g.setColor(bcol);
g.fillRect(0,0,width,height);
g.setFont(Font.getFont(Font.FACE_MONOSPACE,Font.STYLE_PLAIN,Font.SIZE_LARGE));
g.setColor(fcol);
g.drawString(str2,4,4,Graphics.TOP|Graphics.LEFT);
break;
default:
break;
}
}
public void commandAction(Command c, Displayable d)
{
if (c==background)
{
i=1;
repaint();
}
else if(c==textcolor)
{
i=2;
repaint();
}
else if(c==fontstyle)
{
if(j==1)
{
i=3;
sty=0;
j=0;
}
else
{
j=1;
sty=1;
i=4;
}
repaint();
}
else if(c==fontsize)
{
if(j==1 && sty==1)
{
i=5;
sty=0;
}
else if(j==1 && sty==0)
{
i=6;
sty=1;
}
else if(j==0 && sty==1)
{
i=7;
sty=0;
}
else if(j==0 && sty==0)
{
i=8;
sty=1;
}
}
}
public void pauseApp()
{}
public void destroyApp(boolean unconditional)
{}
}
ColorDemo.java
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import java.util.*;
public class ColorDemo extends MIDlet implements CommandListener
{
Command cmdExit,cmdDisp;
TextField txtFld;
Form frm;
Display disp;
ColorCanvas cc;
public void startApp()
{
disp = Display.getDisplay(this);
frm = new Form("Text Demo");
disp.setCurrent(frm);
frm.setCommandListener(this);
cmdExit=new Command("Exit",Command.EXIT,1);
frm.addCommand(cmdExit);
cmdDisp=new Command("Display",Command.SCREEN,1);
frm.addCommand(cmdDisp);
txtFld=new TextField("","",100,TextField.ANY);
frm.append(txtFld);
}
public void pauseApp()
{
}
Output:
}
if(c==mod)
{
int a=Integer.parseInt(tf1.getString());
int b=Integer.parseInt(tf2.getString());
if(b==0)
tf3.setString("Divisor cant be zero");
else
{
int c1=a%b;
tf3.setString(String.valueOf(c1));
}
}
if(c==exit)
{
destroyApp(false);
notifyDestroyed();
}
}
}
Output:
Write a program in J2ME to create a simple Quiz which content 3 to 4 questions and also display
the score.
Code:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.*;
public class QuizDemo extends MIDlet implements CommandListener, ItemStateListener
{
private Display disp;
private Form form1,form2,form3,form4;
private Command exit,next1,next2,next3,submit;
private TextBox msg;
private Item selection;
private ChoiceGroup radiobuttons,rdb2,rdb3,rdb4;
StringItem ms1,ms2,ms3,ms4;
private int defaultIndex;
private int radioButtonIndex;
int flag=1;
public QuizDemo()
{
disp=Display.getDisplay(this);
ms1=new StringItem(null,"which following city is capital of India?");
radiobuttons=new ChoiceGroup("Select your answer",Choice.EXCLUSIVE);
radiobuttons.append("Bangalore",null);
radiobuttons.append("Delhi",null);
radiobuttons.append("Mumbai",null);
radiobuttons.append ("pune",null);
ms2=new StringItem(null,"which foilowing city is capital of Japan?");
rdb2=new ChoiceGroup("Select your answer",Choice.EXCLUSIVE);
rdb2.append("ya ka nua",null);
rdb2.append("Bijieng",null);
rdb2.append("Tokiyo",null);
rdb2.append("ku do su",null);
ms3=new StringItem(null,"which foilowing city is capital of UK?");
rdb3=new ChoiceGroup("Select your answer",Choice.EXCLUSIVE);
rdb3.append("Amsterdam",null);
rdb3.append("London",null);
rdb3.append("New york",null);
rdb3.append("Mexico",null);
ms4=new StringItem(null,"Which following city is capital of Egypt?");
rdb4=new ChoiceGroup("Select your answer",Choice.EXCLUSIVE);
rdb4.append("peru",null);
rdb4.append("Rome",null);
rdb4.append("Kairo",null);
rdb4.append("Sydney",null);
form1=new Form("Question 1");
form1.append(ms1);
radioButtonIndex=form1.append(radiobuttons);
form2=new Form("Question 2");
form2.append(ms2);
radioButtonIndex=form2.append(rdb2);
form3=new Form("QueStion 3");
form3.append(ms3);
radioButtonIndex=form3.append(rdb3);
form4=new Form("Question 4");
form4.append(ms4);
radioButtonIndex=form4.append(rdb4);
exit=new Command("Exit",Command.EXIT,1);
submit=new Command("Submit",Command.SCREEN,1);
next1=new Command("Next",Command.SCREEN,1);
next2=new Command("Next",Command.SCREEN,1);
next3=new Command("Next",Command.SCREEN,1);
msg=new TextBox("Message","Congrats",80,0);
form1.addCommand(next1);
form2.addCommand(next2);
form3.addCommand(next3);
form4.addCommand(submit);
form4.addCommand(exit);
form1.setCommandListener(this);
form2.setCommandListener(this);
form3.setCommandListener(this);
form4.setCommandListener(this);
form1.setItemStateListener(this);
form2.setItemStateListener(this);
form3.setItemStateListener(this);
form4.setItemStateListener(this);
}
public void startApp()
{
disp.setCurrent(form1);
}
Output:
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable s)
{
int n,n1,res=0;
String res1;
n=cg1.getSelectedIndex();
n1=Integer.parseInt(tb.getString());
switch(n)
{
case 0:
res=n1/85;
break;
case 1:
res=n1/75;
break;
case 2:
res=n1/48;
break;
case 3:
res=n1*2;
break;
}
res1=Integer.toString(res);
System.out.println("first="+n1+"\nOperation
Index="+n+"\nResult="+res);
tb1.setString(res1);
}
}
Output :
Output:
}
public void commandAction(Command c,Displayable d)
{
if(c==quit)
{}
}
public void keyPressed(int cd)
{
switch(getGameAction(cd))
{
case Canvas.UP:
y-=5;
dir=1;
break;
case Canvas.DOWN:
y+=5;
dir=2;
break;
case Canvas.LEFT:
x-=5;
dir=3;
break;
case Canvas.RIGHT:
x+=5;
dir=4;
break;
}
}
public void run()
{
while(true)
{
if(dir==1)
y-=5;
else if(dir==2)
y+=5;
else if(dir==3)
x-=5;
else if(dir==4)
x+=5;
repaint();
try
{
th.sleep(500);
}
catch(Exception ee)
{
}
}
}
public void paint(Graphics g)
{
g.setColor(0x1F2F1F);
g.fillRect(x,y,10,10);
g.drawString("Milind Thorat",25,25,Graphics.TOP | Graphics.LEFT);
}
}
Output:
Write a program in J2ME to create a simple database application with an address book with the
following operations:
e.
f.
g.
h.
Insert
Delete
Update
Retrieve
Code:
import java.io.*;
import java.util.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
public class MySQLConn extends MIDlet implements CommandListener
{
private String username;
private String url="http://localhost:8080/jj/getConnection";
private Display display;
private Command exit=new Command("EXIT", Command.EXIT,1);
private Command connect=new Command("Connect", Command.SCREEN,1);
private Form menu;
private TextField tb1;
private TextField tb2;
DBConn db;
public MySQLConn() throws Exception
{
display=Display.getDisplay(this);
}
public void startApp()
{
displayMenu();
}
public void displayMenu()
{
menu=new Form("Connect");
tb1=new TextField("Please input username:","",30,TextField.ANY);
tb2=new TextField("Please input password:","",30,TextField.PASSWORD);
menu.append(tb1);
menu.append(tb2);
menu.addCommand(exit);
menu.addCommand(connect);
menu.setCommandListener(this);
display.setCurrent(menu);
}
public void pauseApp()
{}
public void destroyApp(boolean unconditional)
{}
public void commandAction(Command command,Displayable screen)
{
if(command==exit)
{
destroyApp(false);
notifyDestroyed();
}
else if(command==connect)
{
db=new DBConn(this);
db.start();
db.connectDb(tb1.getString(),tb2.getString());
}
}
public class DBConn implements Runnable
{
MySQLConn midlet;
private Display display;
String db;
String user;
String pwd;
public DBConn(MySQLConn midlet)
{
this.midlet=midlet;
display=Display.getDisplay(midlet);
}
public void start()
{
Thread t=new Thread(this);
t.start();
}
public void run()
{
StringBuffer sb=new StringBuffer();
try
{
HttpConnection c=(HttpConnection) Connector.open(url);
c.setRequestProperty("User-Agent","Profile/MIDP-1.0,
Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language","en-US");
c.setRequestMethod(HttpConnection.POST);
DataOutputStream os=(DataOutputStream)c.openDataOutputStream();
os.writeUTF(user.trim());
os.writeUTF(pwd.trim());
os.flush();
os.close();
DataInputStream is=(DataInputStream)c.openDataInputStream();
int ch;
sb=new StringBuffer();
while((ch=is.read())!=-1)
{
sb.append((char)ch);
}
showAlert(sb.toString());
is.close();
c.close();
}
catch(Exception e)
{
showAlert(e.getMessage());
}
}
public void connectDb(String user,String pwd)
{
this.user=user;
this.pwd=pwd;
}
private void showAlert(String err)
{
Alert a=new Alert("");
a.setString(err);
a.setTimeout(Alert.FOREVER);
display.setCurrent(a);
}
};
}
}
public void doget(HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
{
doPost(request,response);
}
}
Output:
<pre class="example">
#include <stdio. h>
int main()
{
int number;
printf( "Please enter a number: " );
scanf( "70d", &number );
printf( "You entered o/od", number );
return 0;
}
</pre>
The #include and main function before; main must appear in every program you intend to run/
and the #include gives us access to printf as well as scanf. The io in stdio.h stands for
"lnput/output"; std just stands for "standard". The keyword int declares number to be an integer.
The printf function is udes to display strings and scanf function is used to receive input from the
user,
</br></br>
<a href="index.xhtml">HOME</a> <a href="lesson2.xhtml">NEXT</a>
</body>
</html>
Lesson3.xhtml
<?xml version="1,0" encoding ="utf-8"?>
<!DOCTYPE html PUBLIC"-//WAPFORUM//DTD XHTML Mobite 1.O//EN"
"http://www.wapforum.org/DTD/xhtml-mobile 10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title> Lesson 2 of C Tutorial</title></head>
<body>
<Center><h1>Decision Control Structure</h1></center>
<h2>If Syntax</h2>
The structure of an if statement is as follows:
<pre class="example">
if(condition)
{
// if condition is true then this block is executed
}
</pre>
Here is a simple example:
<pre class="example">
if( 5 < 10 )
{
printf("Five is less than ten");
{
</Pre>
<h2>If with Else</h2>
Sometimes when the condition in an if statement evaluates to false, it would be nice to execute
some code instead of the code executed when the statement evaluates to true. The "else"
statement effectively says that whatever code after it (whether a single line or code between
brackets) is executed if the if statement is FALSE.
<pre class="example">
if(TRUE)
{
// if condition is true then this block is executed
}
else
{
// if condition is false then this block is executed
}
</pre>
<h2>Else lf</hz>
Another use of else is when there are multiple conditional statements that may all evaluate to
true, yet you want only one if statement's body to execute. You can use an "else if' statement
following an if statement and its body; that way, if the first statement is true, the "else if" will be
ignored, but if the if statement is false, it will then check the condition for the else if statement, If
the if statement was true the else statement will not be checked. It is possible to use numerous
else if statements to ensure that only one block of code is executed.
<pre class="example">
if(<condition>)
{// Execute these statements if <condition> is TRUE
else if(<anothercondition>)
{
// Execute these statements if <another condition> is TRUE and
// <condition> is FALSE
}
else
{
// Execute this statements if both the above conditions evaluates to false
}
</pre>
<br/>
<a href="index.html">HOME</a> <a href="lesson1.html">PREVIOUS</a>
<a href="lesson3.html">NEXT</a>
</body>
</html>
Output:
using WML
Code: Main.wml
<!-Program to develop a
WML -->
<?xml version="1.0"?>
<!DOCTYPE wml
"-//WAPFORUM//DTD
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card title="Anchor Tag">
<p> <anchor>Go to Login page <go href="form.wml"/> </anchor> </p>
</card>
</wml>
Output:
PUBLIC
WML 1.1//EN"
Code: form.wml
<!-Program to develop a simple website using WML -->
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="KJSIEIT">
<do type="accept" label="Answer">
<go href="#card2"/>
</do><br/>
<p>
<select name="name">
<option value="COMPS">COMPS</option>
<option value="EXTC">EXTC</option>
<option value="IT">IT</option>
</select>
<br/>
First name:<input type="text" name="firstname"/><br/>
Last name:<input type="text" name="lastname"/><br/>
Roll No:<input type="text" name="Rollno"/><br/>
</p>
<p> <anchor> Next page <go href="test.wml"/> </anchor> </p>
</card>
</wml>
Output:
Code: form.wml
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="one" >
<p> Username:<input type="text" name="use"/> <br/><br/>
Password:<input type="password" name="pwd"/>
</p>
<do type="login">
<go href="#two"/>
</do> </card>
<card id="two" >
<p> hello $(use) Your password is $(pwd) </p>
<do type="back">
<go href="#one"/>
</do>
<p> <anchor>Go to text page<go href="text.wml"/> </anchor> </p>
</card>
</wml>
Output:
Code: text.wml
<!-Program to develop a simple website using WML -->
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="KJSIEIT">
<do type="accept" label="Answer">
<go href="#card2"/>
</do><br/>
<p>
<select name="name">
<option value="COMPS">COMPS</option>
<option value="EXTC">EXTC</option>
<option value="IT">IT</option>
</select>
<br/>
First name:<input type="text" name="firstname"/><br/>
Last name:<input type="text" name="lastname"/><br/>
Roll No:<input type="text" name="Rollno"/><br/>
</p>
<p> <anchor> Next page <go href="test.wml"/> </anchor> </p>
</card>
</wml>
Output:
Code: test.wml
<!-Program to develop a simple website using WML -->
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card>
<p>
<p> <anchor>Go to last page <go href="out.wml"/> </anchor> </p>
</p>
</card>
</wml>
Output:
Code: out.wml
<!-Program to develop a simple website using WML -->
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card 1" title="Tutorial">
<do type= "accept" label="Answer">
<go href="#card2"/>
</do>
<p> <select name="name">
<option value="HTML">HTML Tutorial</option>
<option value="XML">XML Tutorial</option>
<option va lue="WAP">WAP Tutorial</option>
</select> </p>
</card>
Bluetooth enabled PC
Bluetooth enabled cell Phone