Sie sind auf Seite 1von 35

K.S.

K ACADEMY
SR. SEC. PUBLIC SCHOOL

DIGITAL FILE
Name :- Deepak Chauhan

Class :- XII – (Ruby)

Roll No :- 10

Subject :- Informatics Practices


INDEX
1:- Math Calculator

2:- Student Grade

3:- Maximum Between Three Number

4:- Vowel or Consonant

5:- String Value

6:- Methods of String

7:- XYZ Pens

8:- Shiksha Vidyalya

9:- Kiddi Land


1) MATH CALCULATOR

INPUT
Coding
(1):- Click on the Add Button and write the code:-

private voidjButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int num1 = Integer.parseInt(jTextField1.getText());

int num2 = Integer.parseInt(jTextField2.getText());

int result = num1+num2;

jTextField3.setText("" + result);

(2):- Click on the Subtract Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int num1 = Integer.parseInt(jTextField1.getText());

int num2 = Integer.parseInt(jTextField2.getText());

int result = num1-num2;

jTextField3.setText("" + result);

(3):- Click on the Multiply Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int num1 = Integer.parseInt(jTextField1.getText());

int num2 = Integer.parseInt(jTextField2.getText());

int result = num1*num2;


RESULT
jTextField3.setText("" + result);

(4):- Click on the Divide Button and write the code:-

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int num1 = Integer.parseInt(jTextField1.getText());

int num2 = Integer.parseInt(jTextField2.getText());

int result = num1/num2;

jTextField3.setText("" + result);

(5):- Click on the Exit Button and write the code:-

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
2) STUDENT GRADE

INPUT
Coding
(1):- Click on the Grade Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

double Total=0;

double Percentage=0;

int m1=Integer.parseInt(jTextField1.getText());

int m2=Integer.parseInt(jTextField2.getText());

int m3=Integer.parseInt(jTextField3.getText());

int m4=Integer.parseInt(jTextField4.getText());

int m5=Integer.parseInt(jTextField5.getText());

Total=m1+m2+m3+m4+m5;

Percentage=Total/5;

if(Percentage>90)

jTextField6.setText("A");

else if((Percentage>=80)&&(Percentage>90))

jTextField6.setText("B");
RESULT
}

else if((Percentage>=70)&&(Percentage>80))

jTextField6.setText("C");

else if((Percentage>=60)&&(Percentage>70))

jTextField6.setText("D");

else

jTextField6.setText("Fail");

(2):- Click On the Clear Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

(3):- Click on the Exit Button and write the code:-

System.exit(0);
3) MAXIMUM BETWEEN THREE NUMBER

INPUT
Coding
(1):-Click on the Maximum Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int num1 = Integer.parseInt(jTextField1.getText());

int num2 = Integer.parseInt(jTextField2.getText());

int num3 = Integer.parseInt(jTextField3.getText());

if((num1>num2)&&(num1>num3))

jTextField4.setText(""+num1);

else if((num2>num1)&&(num2>num3))

jTextField4.setText(""+num2);

else

jTextField4.setText(""+num3);

}
RESULT
(2):- Click on the Clear Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

(3):- Click on the Exit Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
4) VOWEL OR CONSONANT

INPUT
Coding
(1):- Click on the Result Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String alph=jTextField2.getText();

switch(alph)

case"a":

jTextField2.setText("Vowel");

break;

case"e":

jTextField2.setText("Vowel");

break;

case"i":

jTextField2.setText("Vowel");

break;

case"o":

{
RESULT
jTextField2.setText("Vowel");

break;

case"u":

jTextField2.setText("Vowel");

break;

default:

jTextField2.setText("Consonant");

break;

(2):- Click on the Clear Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

(3):- Click on the Exit Button and write the following

code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
5) STRING VALUES

INPUT
Coding
(1):- Click on the Result Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String input = jTextField1.getText();

jTextField2.setText(input.charAt(5));

jTextField3.setText(""+input.length());

(2):-Click on the Clear Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

(3):- Click on the Exit Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
6).METHODS OF STRING

RESULT
Coding
(1):- Click on the Result Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String inputString=jTextField1.getText();

jTextField2.setText(inputString.toUpperCase());

jTextField3.setText(inputString.toLowerCase());

jTextField4.setText(inputString.concat("Singh"));

(2):- Click on the Clear Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

(3):- Click on the Exit Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);
7) XYZ PENS CO.

INPUT
Coding
(1):- Click Calculate Button and write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

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

int amount = num*25;

jTextField3.setText("" + amount);

double discount=0;

if(jCheckBox1.isSelected())

discount = amount*5/100;

jTextField4.setText("" + discount);

double total = amount-discount;

jTextField5.setText("" + total);

(2):- Click on the Clear Button and write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");
RESULT
jTextField5.setText("");

(3):- Click on the Exit Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
8) SHIKSHA VIDYALAYA

INPUT
C Coding
(1):- Click on the Calculate Total Score Button and

write the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int total = 0;

if(jCheckBox1.isSelected())

jTextField3.setText("" + 10);

total = total+10;

if(jCheckBox2.isSelected())
{

jTextField4.setText("" + 10);

total=total+10;

if(jCheckBox3.isSelected())

jTextField5.setText("" + 10);

total=total+10;

jTextField6.setText("" + total);

RESULT
(2):- Click on the Clear Button and write the code:-

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");
jTextField6.setText("");

(3):- Click on the Exit Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

System.exit(0);
9) KIDDI LAND

INPUT
Coding
(1):- Click on the Calculate Discount Button and write

the code:-

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

double discount;

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

if(jRadioButton1.isSelected()==true)

discount = amount*0.20;

else if(jRadioButton2.isSelected()==true)

discount = amount*0.15;

else

discount = amount*0.10;

jTextField3.setText("" + discount);

double add;

if(amount>25000)

add = amount*25000;

jTextField4.setText("");

jButton2.setEnabled(true);

(2):- Click on the Calculate Net Amount Button and

write the code:-

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


RESULT
// TODO add your handling code here:

double TotalCost=Double.parseDouble(jTextField2.getText());

double Offer=Double.parseDouble(jTextField3.getText());

double AdditionalOffer=Double.parseDouble(jTextField4.getText());

double NetAmount=TotalCost-Offer-AdditionalOffer;

jTextField5.setText(""+NetAmount);

(3):- Click on the Clear Button and write the code:-

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

Das könnte Ihnen auch gefallen