Sunteți pe pagina 1din 15

Informatics

Practices
Project Report File
2014-15

Submitted to Ms Shalenee Bawa


I.P. Teacher
S.D. Vidya Mandir
Panipat

Submitted By-

EXPERIMENT NO.
Aim - Design a GUI application to capitalize FIRST CHARCATER of each
Word of a string.
Convert Button
String a= tf.getText();
String b,c,d,f="",e;
int i = 1;
int num = a.length();
d = a.substring(1,num);
e = a.substring(0,1);
e = e.toUpperCase();
a = e+d;
do
{
b = a.substring(i,++i);
if (b.equals(""))
{
c = a.substring(0,i);
d = a.substring(i+1,num);
e = a.substring(i,i+1);
e = e.toUpperCase();
a = c+e+d;
}
} while(i<=num-1);
ctf.setText(a);

Exit Button

System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application to calculate sum of digits of a number.

Calculate Button

long num = Integer.parseInt(tf.getText());


long a;
long sum = 0;
do
{a = num%10;
sum = sum + a;
num = num/10;
} while(num>0);
lbl.setText("Sum of Digits is "+sum);

Exit Button
System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application to calculate factorial of a number.

Calculate Button

int num = Integer.parseInt(tf.getText());


int i = 0, fact=1;

while(i<num)
{ i++;
fact= fact*i;
}

lbl.setText("Factorial of "+num+ " is "+fact);

Exit Button
System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application to accept amount and customer type
from a user and thus calculate discount and final price to be paid. Also
offer and additional discount for VISA Debit card user.
Calculate Amount Button

double amount = Double.parseDouble(tf.getText());


double d;

if(cb.getSelectedIndex()==1)
d=0.1;
else if(cb.getSelectedIndex()==2)
d=0.2;
else if(cb.getSelectedIndex()==3)
d=0.4;
else d=0;

if(chb.isSelected()== true)
d= d+0.05;

double discount = d * amount;


double fprice = amount - discount;
fprice = Math.round(fprice);
lbl.setText("Pay Rs. "+fprice);

Exit Button
System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application for a FOOTBALL match scoreboard.
Scored Goal Button(for Team GREEN)
int num = Integer.parseInt(tf1.getText());
num = num + 1;
tf1.setText(""+num);

Scored Goal Button(for Team RED)


int num = Integer.parseInt(tf2.getText());
num = num + 1;
tf2.setText(""+num);

Determine Winner Button


int num1 = Integer.parseInt(tf1.getText());
int num2 = Integer.parseInt(tf2.getText());

if(num1>num2)
lbl.setText("WINNER IS TEAM GREEN");
else if (num1<num2)
lbl.setText("WINNER IS TEAM RED");
else
lbl.setText("MATCH IS DRAW");

Exit Button
System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application to sum of even and odd numbers up to a
number submitted in a text field.

Calculate Button
int num= Integer.parseInt(tf.getText());
int osm=0; int esm=0; int i=1; int j=0;
do
{osm=i+osm;
i=i+2;
}
while(i<=num);
ta.append("sum of odd nos. is "+osm);
do
{esm=j+esm;
j=j+2;
}
while(j<=num);
ta.append("\nsum of even nos. is "+esm);

Reset Button
tf.setText("");
ta.setText("");

Exit Button
System.exit(0);

EXPERIMENT NO.
Aim - Design a GUI application to create a 2D pyramid with no. of rows
entered by user using loops.

Calculate Button
String b="";
String a= "@"; int i=0;
int n;
n = Integer.parseInt(tf.getText());
ta.setText("");
do{
i=i+1;
for(int c=i;c<=n;c++)
{ta.append(b);}
for(int d=1;d<=(2*i-1);d++)
{ta.append(a);}
ta.append("\n");
} while(i<n);

Reset Button
tf.setText("");
ta.setText("");

Exit Button
System.exit(0);

S-ar putea să vă placă și