0% found this document useful (0 votes)
40 views15 pages

Informatics Practices: Project Report File 2014-15

This document contains code for several GUI applications designed as Informatics Practices projects, including: 1. An application to capitalize the first character of each word in a string. 2. An application to calculate the sum of digits in a number. 3. An application to calculate the factorial of a number. 4. An application to calculate discounts and final prices based on customer type and card used. 5. An application for a football match scoreboard. 6. An application to calculate sums of even and odd numbers. 7. An application to create a 2D pyramid pattern based on a user-entered number of rows.

Uploaded by

Naman Sachdeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views15 pages

Informatics Practices: Project Report File 2014-15

This document contains code for several GUI applications designed as Informatics Practices projects, including: 1. An application to capitalize the first character of each word in a string. 2. An application to calculate the sum of digits in a number. 3. An application to calculate the factorial of a number. 4. An application to calculate discounts and final prices based on customer type and card used. 5. An application for a football match scoreboard. 6. An application to calculate sums of even and odd numbers. 7. An application to create a 2D pyramid pattern based on a user-entered number of rows.

Uploaded by

Naman Sachdeva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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);

You might also like