SlideShare a Scribd company logo
1 of 43
PROGRAM FILE 
Particulars of the student 
Name: Nidhi Gupta 
Roll No. : 
Class: XII Commerce A 
Particulars of the Supervisor 
Name: Monika Sharma 
Designation: Sardar Patel Public Senior Secondary 
School
ACKNOWLEDGEMENT 
It is with great pleasure that I find myself 
penning down these lines to express my 
sincere thanks to various people who helped 
me a long way in completing this project. 
The harmonious climate in our school provided 
proper guide for preparing the project. It was 
a privilege to have been guided by Mrs. Monika 
Sharma. 
Thanks to all my classmates who helped me 
during the development of this project with 
their constructive criticism and advice. 
NEW DELHI Nidhi Gupta 
Roll no.
NETBEANS PROGRAMS 
1. Write a Java desktop application to find the sum of two 
numbers using Java method. 
Ans. 
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
public void Sum_Num() 
{ 
int a, b, sum = 0; 
a = Integer.parseInt(jTextField1.getText()); 
b = Integer.parseInt(jTextField2.getText());
sum = a + b ; 
jTextField3.setText(" " + sum); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
Sum_Num(); 
} 
Result : 
2. Create an application to enter your name and age in 
separate JTextField controls and display both name and 
age in a JLabel control.The display will perform when 
youy press aJButton control.Notice that theJButton will 
perform its action event operation. 
Ans.
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
String name = jTextField1.getText(); 
int age = Integer.parseInt(jTextField2.getText()); 
jLabel3.setText("Name is: " + name + " and Age is:" + age); 
} 
Result :
3. Create a java Desktop Application which adds sevral 
employee’s name , removes a selected name and clear 
all the employee’s names from a JComboBox control. 
Ans.
Coding : 
private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void btnCAddActionPerformed(java.awt.event.ActionEvent evt) { 
//Creating a String object Ename 
String Ename = txtEname.getText(); 
//Creating a ComboBoxModel object cModel to perform 
//DefaultComboBoxModel method operations 
DefaultComboBoxModel cModel = 
(DefaultComboBoxModel) jComboBox1.getModel(); 
//Method to add elements into jComboBox1 control 
cModel.addElement(Ename); 
//Sets the data model for jComboBox1 control 
jComboBox1.setModel(cModel);
//Sets the txtEname to null 
txtEname.setText(""); 
} 
private void btnCRemoveActionPerformed(java.awt.event.ActionEvent evt) { 
//Creating aString object Ename 
String Ename = (String) jComboBox1.getSelectedItem(); 
int ind = jComboBox1.getSelectedIndex(); 
//Creating aComboBoxModel object cModel to perform 
//DefaultComboBoxModel method operations 
DefaultComboBoxModel cModel = 
(DefaultComboBoxModel) jComboBox1.getModel(); 
cModel.removeElementAt(ind); 
JOptionPane.showMessageDialog(this,"Deleted name" + Ename); 
jComboBox1.setModel(cModel); 
} 
private void btnCClearActionPerformed(java.awt.event.ActionEvent evt) { 
DefaultComboBoxModel cModel = 
(DefaultComboBoxModel) jComboBox1.getModel(); 
cModel.removeAllElements(); 
} 
Result :
4. Create a java desktop application to perform a 
concatenation opretion for the two JTextField 
components on the window.get First name and Last 
name in it. On clicking Click to Concatenate button a 
message should appear by joining First name + Last 
name. 
Ans.
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
JOptionPane.showMessageDialog(this,jTextField3.getText() + " " +jTextField1.getText()); 
} 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
Result :
5. Write a program to perform the closing window 
operation with different buttons. 
Ans.
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
jLabel2.setText("Red light is on, please relax"); 
} 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
jLabel2.setText("Yellow light is on, please stop"); 
} 
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { 
jLabel2.setText("Green ligh is on, please go"); 
} 
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { 
jLabel2.setText("You perform demo buttons."); 
System.exit(0); 
} 
Result :
6. Create a Jav Desktop Application to enter your friends 
rollno,name,address,section and grade. Using 
aJButton’s click evant handler, display the details of 
inputs into aJTextArea control. 
Ans. 
Coding :
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextArea1.append("Friend's Data" + "n");//Roll No. 
jTextArea1.append("Roll No. :" + jTextField1.getText() + "n"); 
jTextArea1.append("Name :" + jTextField2.getText() + "n"); 
jTextArea1.append("Address :" + jTextField3.getText() + "n"); 
jTextArea1.append("Section :" + jTextField4.getText() + "n"); 
jTextArea1.append("Grade :" + jTextField5.getText() + "n"); 
Result :
7. Demonstrate global scope variable in Java GUI 
application. 
Ans. 
Coding : 
@SuppressWarnings("unchecked") 
public int i; 
void Scope2() 
{ 
i = 20; 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
Scope2(); 
int i = 40; 
jTextArea1.append(i + "n"); 
} 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0);
} 
Result : 
8. Demonstrating if Statement to add contents into a 
JTextArea component. 
Ans.
Coding : 
private void bntExitActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void btnResultActionPerformed(java.awt.event.ActionEvent evt) { 
int num;//Variable to hold input value. 
double square;//Variable to hold square value. 
num = Integer.parseInt(txtNum.getText()); 
if(num < 120) 
{ 
square = num*num; 
//jTextArea component appending text into its area 
// /n is used as escape sequence andpointer transfer into next line 
jTextArea1.append("The square of" + num + square + "n"); 
} 
if (num >= 120) 
{ 
jTextArea1.append("***Square is not allowed for numbers over120***n"); 
jTextArea1.append("Run this program again and try a smaller value.n"); 
} 
jTextArea1.append("Thank you for requesting squares." 
} 
Result :
9. Develop a GUI application to demonstrate the 
JCheckBox By inputing your name in a JTextField 
control and set different font, style, size and color into 
name using JCheckBox control. 
Ans.
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setForeground(new Color(255,0,0)) 
} 
private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setForeground(new Color(0,255,0)); 
} 
private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setForeground(new Color(255,255,0)); 
} 
private void jCheckBox4ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setForeground(new Color(255,255,0)); 
} 
private void jCheckBox5ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setFont(new Font("Helvetica",Font.BOLD,18)); 
} 
private void jCheckBox6ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setFont(new Font("Helvetica",Font.ITALIC,12)); 
} 
private void jCheckBox7ActionPerformed(java.awt.event.ActionEvent evt) { 
jTextField1.setFont(new Font("Helvetica",Font.BOLD + Font.ITALIC,12)); 
} 
private void jCheckBox8ActionPerformed(java.awt.ev ent.ActionEvent evt) { 
jTextField1.setFont(new Font("Helvetica",Font.PLAIN,12)); 
} 
Result :
10. Write a GUI application to display the JList control 
value an oter controls like JLabel,jTextField and 
JTextArea.Perform the opreation with aJbutton 
ActionPerformed procedure. 
Ans. 
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
String pName = (String) jList1.getSelectedValue(); 
jLabel1.setText("You selected" + pName); 
jTextField1.setText(pName); 
jTextArea1.append(pName); 
}
Result : 
11. Design a GUI application to input different numbers 
through keyboard using showInputdialog method and 
find maximum number between n numbers. 
Ans.
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
int max = 0, i = 1, num, n; 
String str = JOptionPane.showInputDialog("Enter total number number you want find maximum..."); 
n = Integer.parseInt(str); 
while(i <= n){ 
str =JOptionPane.showInputDialog("Enter number",i); 
jTextArea1.append(s tr + "n"); 
num =Integer.parseInt(str); 
if (num > max) 
max = num; 
i++; 
} 
jTextField1.setText(Integer.toString(max)); 
} 
Result :
12. Create an application using JButton component to 
print “Hello NetBeans Programmer” in a message box 
.note that the message box can be created with the 
showMessageDialog() method.This method is the 
instance of Java JOptionPane class.So before using this 
method add the following line at the top of source: 
Import javax.swing.JOptionPane; 
Ans.
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
JOptionPane.showMessageDialog(this,"Hello NetBeans Programmer"); 
} 
Result : 
13. Develop a Java desktop application to demonstrate 
JOptionPane dialog boxwith differentmessages and 
opton button. 
Ans.
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
int messageType= -2, optionType= -2; 
String messT = "", optT = ""; 
if (jRadioButton1.isSelected()){ 
messageType = -1; 
messT = "JOptionPane.PLAIN_MESSAGE"; 
}else if (jRadioButton2.isSelected()){ 
messageType = 0; 
messT = "JOptinPane.ERROR_MESSAGE"; 
}else if (jRadioButton3.isSelected()){ 
messageType = 1; 
messT = "JOptionPane.INFORMATION_MESSAGE"; 
}else if (jRadioButton4.isSelected()){ 
messageType = 2; 
messT = "JOptionPane.WARNING_MESSAGE"; 
} 
if(jRadioButton5.isSelected()){ 
optionType = -1; 
optT = "JOptionPane.DEFAULT_OPTION"; 
}else if (jRadioButton6.isSelected()){ 
optionType = 0; 
optT = "JOptionPane.YES_NO_OPTION"; 
}else if (jRadioButton7.isSelected()){
optionType = 1; 
optT = "JOptionPane.YES_NO_CANCEL_OPTION"; 
}else if (jRadioButton8.isSelected()){ 
optionType = 2; 
optT = "JOptionPane.OK_CANCEL_OPTION"; 
} 
JOptionPane.showConfirmDialog(this, 
"This message dialog with default OK button.", 
"JOptionPane Dialog",messageType, optionType); 
jTextField1.setText(messT + " " + optT); 
messageType = -2; 
optionType = -2; 
} 
Result :
14. Demonstratethe simple method overloading 
concepts without using class. 
Ans.
Coding : 
@SuppressWarnings("unchecked") 
void show(int roll){ 
jTextField1.setText(Integer.toString(roll)); 
} 
void show(double fees) { 
jTextField2.setText(Double.toString(fees)); 
} 
void show(String name){ 
jTextField3.setText(name); 
} 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
show(100); 
show(12000.333); 
show("Ms Nidhi Gupta"); 
} 
Result :
15. Create a Java desktop application to perform a 
password entry system and also see the entry in a 
message window. 
Ans.
Coding : 
private void jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) { 
//Extract a password string into String passW 
String passW = new String(jPasswordField1.getPassword()); 
JOptionPane.showMessageDialog(this,passW); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
Result :
16. Develop a Java DesktopApplication to display a 
message “Hello! I am a Java NetBeans IDE 
Programmer.”using two commandbuttons Print and Exit. 
Ans. 
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
jLabel1.setText("Hello I am a java programmer."); 
} 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
Result :
17. Design a GUI application to input any number and 
print them in reverse order using while 
statement.Whereas the input number must be positive 
otherwise display a message containing (“The number 
must be positive”). 
Ans. 
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
String str; 
int value, rDigit; 
value = 0; 
while(value <= 0) { 
value = Integer.parseInt(jButton1.getText()); 
if(value <= 0) { 
JOptionPane.showMessageDialog(this,"The number must be positive");
break; 
} 
} 
str = ""; 
while(value!=0){ 
rDigit = value%10; 
str = str + Integer.toString(rDigit); 
value = value /10; 
} 
jButton1.setText(str); 
} 
Result : 
18. Create a GUI application to calculate the simple 
interest .Using four JLabel, four JTextField and two 
JButton control s input the principal amount, interest 
rate and time period.Find the interest amount using 
Calculate button. 
Ans.
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
} 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
double Principal = Double.parseDouble(jTextField1.getText()); 
double Rate = Double.parseDouble(jTextField2.getText()); 
double Time = Double.parseDouble(jTextField3.getText()); 
double SI =(Principal*Rate*Time)/100; 
jTextField4.setText(""+ SI); 
} 
Result :
19. Create GUI Desktop Application to find sum of two 
numbers using showInputDialog() method. 
Ans. 
Coding : 
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int Fnumber,Snumber,sum; 
String num1, num2; 
num1 = JOptionPane.showInputDialog("Enter number"); 
num2 = JOptionPane.showInputDialog("Enter number"); 
Fnumber = Integer.parseInt(num1); 
Snumber = Integer.parseInt(num2); 
sum = Fnumber = Snumber; 
JOptionPane.showMessageDialog(null,"The sum of two number is" + sum); 
} 
Result :
20. Develop a java Desktop Application to Verify 
wherther the swapped ATM card accepted password or 
not. 
Ans. 
Coding : 
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { 
System.exit(0); 
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { 
String iPass = "mohan 123"; 
String Epass = new String (jPasswordField1.getPassword()); 
if(Epass.equals(iPass)){ 
jTextField3.setText("You are a valid ATM holder"); 
}else 
jTextField3.setText("You don't have an account in SBI"); 
} 
Result :
MYSQL COMMAND QUERIES 
1. Write a query to display the TNO, TNAME and salary 
from TEACHER table. 
Ans. 
2. Write a query to display teacher name and salary for all 
teacher whose salary is greater than equal to 20000. 
Ans. 
3. Write a query to display the teacher name either 
‘Rakesh Sharma’ or ‘Jugal Mittal’. 
Ans.
4. Write a query to display the teacher information whose 
salary is not more than 15000. 
Ans. 
5. Write a query to display distinct department no. 
(dept_no) from TEACHER table. 
Ans. 
6. Write a query to display the teacher no and teacher 
name whose salary is not in between 15000 and 20000. 
Ans.
7. Write a query to display TNO,TNAME and SALARY 
whose salary is more than 18000 using colulmn alias. 
Ans. 
8. Write a query to display TNO, TNAME and SALARY 
whose salary is more than 18000 using column alias. 
Ans. 
9. Write a query to display TNO, TNAME and ANNUAL 
salary of all TEACHERS.
Ans. 
10. Write a query to retrive the first five rows of the 
table TEACHER. 
Ans.

More Related Content

What's hot

The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)Scott Wlaschin
 
Js set timeout & setinterval
Js set timeout & setintervalJs set timeout & setinterval
Js set timeout & setintervalARIF MAHMUD RANA
 
Functional Design Patterns (DevTernity 2018)
Functional Design Patterns (DevTernity 2018)Functional Design Patterns (DevTernity 2018)
Functional Design Patterns (DevTernity 2018)Scott Wlaschin
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance HaskellJohan Tibell
 
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDay
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDayHosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDay
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDayAruba S.p.A.
 
Computer science project work
Computer science project workComputer science project work
Computer science project workrahulchamp2345
 
Multithread design pattern
Multithread design patternMultithread design pattern
Multithread design pattern종빈 오
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8LivePerson
 
Bài 5: Java Bean - Lập Trình Mạng Nâng Cao
Bài 5: Java Bean - Lập Trình Mạng Nâng CaoBài 5: Java Bean - Lập Trình Mạng Nâng Cao
Bài 5: Java Bean - Lập Trình Mạng Nâng CaoTuan Nguyen
 
Async History - javascript
Async History - javascriptAsync History - javascript
Async History - javascriptNishchit Dhanani
 
C s investigatory project on telephone directory
C s  investigatory project on telephone directoryC s  investigatory project on telephone directory
C s investigatory project on telephone directorySHUBHAM YADAV
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in ScalaPatrick Nicolas
 
Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Scott Wlaschin
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use casesFabio Biondi
 
Report Card making BY Mitul Patel
Report Card making BY Mitul PatelReport Card making BY Mitul Patel
Report Card making BY Mitul PatelMitul Patel
 
Reactive clean architecture
Reactive clean architectureReactive clean architecture
Reactive clean architectureViktor Nyblom
 
The lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsThe lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsScott Wlaschin
 

What's hot (20)

The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)The Functional Programming Toolkit (NDC Oslo 2019)
The Functional Programming Toolkit (NDC Oslo 2019)
 
Js set timeout & setinterval
Js set timeout & setintervalJs set timeout & setinterval
Js set timeout & setinterval
 
ATG Advanced RQL
ATG Advanced RQLATG Advanced RQL
ATG Advanced RQL
 
Functional Design Patterns (DevTernity 2018)
Functional Design Patterns (DevTernity 2018)Functional Design Patterns (DevTernity 2018)
Functional Design Patterns (DevTernity 2018)
 
High-Performance Haskell
High-Performance HaskellHigh-Performance Haskell
High-Performance Haskell
 
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDay
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDayHosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDay
Hosting e file HTACCESS, come funziona e come si modifica - #TipOfTheDay
 
JavaScript Promises
JavaScript PromisesJavaScript Promises
JavaScript Promises
 
Computer science project work
Computer science project workComputer science project work
Computer science project work
 
Multithread design pattern
Multithread design patternMultithread design pattern
Multithread design pattern
 
Functional programming with Java 8
Functional programming with Java 8Functional programming with Java 8
Functional programming with Java 8
 
Bài 5: Java Bean - Lập Trình Mạng Nâng Cao
Bài 5: Java Bean - Lập Trình Mạng Nâng CaoBài 5: Java Bean - Lập Trình Mạng Nâng Cao
Bài 5: Java Bean - Lập Trình Mạng Nâng Cao
 
Async History - javascript
Async History - javascriptAsync History - javascript
Async History - javascript
 
C s investigatory project on telephone directory
C s  investigatory project on telephone directoryC s  investigatory project on telephone directory
C s investigatory project on telephone directory
 
Advanced Functional Programming in Scala
Advanced Functional Programming in ScalaAdvanced Functional Programming in Scala
Advanced Functional Programming in Scala
 
Express js
Express jsExpress js
Express js
 
Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)Domain Modeling with FP (DDD Europe 2020)
Domain Modeling with FP (DDD Europe 2020)
 
Angular & RXJS: examples and use cases
Angular & RXJS: examples and use casesAngular & RXJS: examples and use cases
Angular & RXJS: examples and use cases
 
Report Card making BY Mitul Patel
Report Card making BY Mitul PatelReport Card making BY Mitul Patel
Report Card making BY Mitul Patel
 
Reactive clean architecture
Reactive clean architectureReactive clean architecture
Reactive clean architecture
 
The lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsThe lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of tests
 

Viewers also liked

Yaritza citallie colorado
Yaritza citallie coloradoYaritza citallie colorado
Yaritza citallie coloradoMelissa Medina
 
Gandara - 2016 Official Ballot
Gandara - 2016 Official BallotGandara - 2016 Official Ballot
Gandara - 2016 Official BallotCalbayog Journal
 
sejarah tentang android
sejarah tentang androidsejarah tentang android
sejarah tentang androidlisyetupalessy
 
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshi
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshiHazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshi
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshiMuhammad Tariq
 
Tendex - онлайн площадка для проведения электронных торгов
Tendex - онлайн площадка для проведения электронных торговTendex - онлайн площадка для проведения электронных торгов
Tendex - онлайн площадка для проведения электронных торговE-COM UA
 
English Speaking Skill
English Speaking SkillEnglish Speaking Skill
English Speaking SkillRajeev Ranjan
 
Военная техника
Военная техникаВоенная техника
Военная техникаazimaura
 

Viewers also liked (14)

Ppt pesimis fixs
Ppt pesimis fixsPpt pesimis fixs
Ppt pesimis fixs
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
Yaritza citallie colorado
Yaritza citallie coloradoYaritza citallie colorado
Yaritza citallie colorado
 
Gandara - 2016 Official Ballot
Gandara - 2016 Official BallotGandara - 2016 Official Ballot
Gandara - 2016 Official Ballot
 
sejarah tentang android
sejarah tentang androidsejarah tentang android
sejarah tentang android
 
feelings
feelingsfeelings
feelings
 
technikhomes-wall sign
technikhomes-wall signtechnikhomes-wall sign
technikhomes-wall sign
 
Ux 101
Ux 101Ux 101
Ux 101
 
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshi
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshiHazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshi
Hazrat imam azam ki fiqhi baseerat dr muhammad ishaq qureshi
 
Manual de trochas
Manual de trochasManual de trochas
Manual de trochas
 
Tendex - онлайн площадка для проведения электронных торгов
Tendex - онлайн площадка для проведения электронных торговTendex - онлайн площадка для проведения электронных торгов
Tendex - онлайн площадка для проведения электронных торгов
 
English Speaking Skill
English Speaking SkillEnglish Speaking Skill
English Speaking Skill
 
resume
resumeresume
resume
 
Военная техника
Военная техникаВоенная техника
Военная техника
 

Similar to New microsoft office word document

CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
 
Informatics Practice Practical for 12th class
Informatics Practice Practical for 12th classInformatics Practice Practical for 12th class
Informatics Practice Practical for 12th classphultoosks876
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfudit652068
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manualsameer farooq
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to JavascriptAnjan Banda
 
Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)Lifeparticle
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
Write a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdfWrite a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdffathimaoptical
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answersQuratulain Naqvi
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfflashfashioncasualwe
 
Java final project of scientific calcultor
Java final project of scientific calcultorJava final project of scientific calcultor
Java final project of scientific calcultorMd. Eunus Ali Rupom
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good TestsTomek Kaczanowski
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diplomamustkeem khan
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbroncymbron
 

Similar to New microsoft office word document (20)

CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
Informatics Practice Practical for 12th class
Informatics Practice Practical for 12th classInformatics Practice Practical for 12th class
Informatics Practice Practical for 12th class
 
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdfWorking with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
Working with Layout Managers. Notes 1. In part 2, note that the Gam.pdf
 
Java programming lab manual
Java programming lab manualJava programming lab manual
Java programming lab manual
 
Intro to Javascript
Intro to JavascriptIntro to Javascript
Intro to Javascript
 
Day 5
Day 5Day 5
Day 5
 
Java: GUI
Java: GUIJava: GUI
Java: GUI
 
Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)Tech Talk: App Functionality (Android)
Tech Talk: App Functionality (Android)
 
informatics practices practical file
informatics practices practical fileinformatics practices practical file
informatics practices practical file
 
Java practical
Java practicalJava practical
Java practical
 
code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
Write a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdfWrite a GUI application to simulate writing out a check. The value o.pdf
Write a GUI application to simulate writing out a check. The value o.pdf
 
OOP program questions with answers
OOP program questions with answersOOP program questions with answers
OOP program questions with answers
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
 
Java final project of scientific calcultor
Java final project of scientific calcultorJava final project of scientific calcultor
Java final project of scientific calcultor
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Java Practical File Diploma
Java Practical File DiplomaJava Practical File Diploma
Java Practical File Diploma
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 

New microsoft office word document

  • 1. PROGRAM FILE Particulars of the student Name: Nidhi Gupta Roll No. : Class: XII Commerce A Particulars of the Supervisor Name: Monika Sharma Designation: Sardar Patel Public Senior Secondary School
  • 2. ACKNOWLEDGEMENT It is with great pleasure that I find myself penning down these lines to express my sincere thanks to various people who helped me a long way in completing this project. The harmonious climate in our school provided proper guide for preparing the project. It was a privilege to have been guided by Mrs. Monika Sharma. Thanks to all my classmates who helped me during the development of this project with their constructive criticism and advice. NEW DELHI Nidhi Gupta Roll no.
  • 3. NETBEANS PROGRAMS 1. Write a Java desktop application to find the sum of two numbers using Java method. Ans. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } public void Sum_Num() { int a, b, sum = 0; a = Integer.parseInt(jTextField1.getText()); b = Integer.parseInt(jTextField2.getText());
  • 4. sum = a + b ; jTextField3.setText(" " + sum); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Sum_Num(); } Result : 2. Create an application to enter your name and age in separate JTextField controls and display both name and age in a JLabel control.The display will perform when youy press aJButton control.Notice that theJButton will perform its action event operation. Ans.
  • 5. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String name = jTextField1.getText(); int age = Integer.parseInt(jTextField2.getText()); jLabel3.setText("Name is: " + name + " and Age is:" + age); } Result :
  • 6. 3. Create a java Desktop Application which adds sevral employee’s name , removes a selected name and clear all the employee’s names from a JComboBox control. Ans.
  • 7. Coding : private void btnCloseActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void btnCAddActionPerformed(java.awt.event.ActionEvent evt) { //Creating a String object Ename String Ename = txtEname.getText(); //Creating a ComboBoxModel object cModel to perform //DefaultComboBoxModel method operations DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel(); //Method to add elements into jComboBox1 control cModel.addElement(Ename); //Sets the data model for jComboBox1 control jComboBox1.setModel(cModel);
  • 8. //Sets the txtEname to null txtEname.setText(""); } private void btnCRemoveActionPerformed(java.awt.event.ActionEvent evt) { //Creating aString object Ename String Ename = (String) jComboBox1.getSelectedItem(); int ind = jComboBox1.getSelectedIndex(); //Creating aComboBoxModel object cModel to perform //DefaultComboBoxModel method operations DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel(); cModel.removeElementAt(ind); JOptionPane.showMessageDialog(this,"Deleted name" + Ename); jComboBox1.setModel(cModel); } private void btnCClearActionPerformed(java.awt.event.ActionEvent evt) { DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel(); cModel.removeAllElements(); } Result :
  • 9. 4. Create a java desktop application to perform a concatenation opretion for the two JTextField components on the window.get First name and Last name in it. On clicking Click to Concatenate button a message should appear by joining First name + Last name. Ans.
  • 10. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JOptionPane.showMessageDialog(this,jTextField3.getText() + " " +jTextField1.getText()); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } Result :
  • 11. 5. Write a program to perform the closing window operation with different buttons. Ans.
  • 12. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jLabel2.setText("Red light is on, please relax"); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { jLabel2.setText("Yellow light is on, please stop"); } private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { jLabel2.setText("Green ligh is on, please go"); } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { jLabel2.setText("You perform demo buttons."); System.exit(0); } Result :
  • 13. 6. Create a Jav Desktop Application to enter your friends rollno,name,address,section and grade. Using aJButton’s click evant handler, display the details of inputs into aJTextArea control. Ans. Coding :
  • 14. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jTextArea1.append("Friend's Data" + "n");//Roll No. jTextArea1.append("Roll No. :" + jTextField1.getText() + "n"); jTextArea1.append("Name :" + jTextField2.getText() + "n"); jTextArea1.append("Address :" + jTextField3.getText() + "n"); jTextArea1.append("Section :" + jTextField4.getText() + "n"); jTextArea1.append("Grade :" + jTextField5.getText() + "n"); Result :
  • 15. 7. Demonstrate global scope variable in Java GUI application. Ans. Coding : @SuppressWarnings("unchecked") public int i; void Scope2() { i = 20; } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Scope2(); int i = 40; jTextArea1.append(i + "n"); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0);
  • 16. } Result : 8. Demonstrating if Statement to add contents into a JTextArea component. Ans.
  • 17. Coding : private void bntExitActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void btnResultActionPerformed(java.awt.event.ActionEvent evt) { int num;//Variable to hold input value. double square;//Variable to hold square value. num = Integer.parseInt(txtNum.getText()); if(num < 120) { square = num*num; //jTextArea component appending text into its area // /n is used as escape sequence andpointer transfer into next line jTextArea1.append("The square of" + num + square + "n"); } if (num >= 120) { jTextArea1.append("***Square is not allowed for numbers over120***n"); jTextArea1.append("Run this program again and try a smaller value.n"); } jTextArea1.append("Thank you for requesting squares." } Result :
  • 18. 9. Develop a GUI application to demonstrate the JCheckBox By inputing your name in a JTextField control and set different font, style, size and color into name using JCheckBox control. Ans.
  • 19. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setForeground(new Color(255,0,0)) } private void jCheckBox2ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setForeground(new Color(0,255,0)); } private void jCheckBox3ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setForeground(new Color(255,255,0)); } private void jCheckBox4ActionPerformed(java.awt.event.ActionEvent evt) {
  • 20. jTextField1.setForeground(new Color(255,255,0)); } private void jCheckBox5ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setFont(new Font("Helvetica",Font.BOLD,18)); } private void jCheckBox6ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setFont(new Font("Helvetica",Font.ITALIC,12)); } private void jCheckBox7ActionPerformed(java.awt.event.ActionEvent evt) { jTextField1.setFont(new Font("Helvetica",Font.BOLD + Font.ITALIC,12)); } private void jCheckBox8ActionPerformed(java.awt.ev ent.ActionEvent evt) { jTextField1.setFont(new Font("Helvetica",Font.PLAIN,12)); } Result :
  • 21. 10. Write a GUI application to display the JList control value an oter controls like JLabel,jTextField and JTextArea.Perform the opreation with aJbutton ActionPerformed procedure. Ans. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String pName = (String) jList1.getSelectedValue(); jLabel1.setText("You selected" + pName); jTextField1.setText(pName); jTextArea1.append(pName); }
  • 22. Result : 11. Design a GUI application to input different numbers through keyboard using showInputdialog method and find maximum number between n numbers. Ans.
  • 23. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int max = 0, i = 1, num, n; String str = JOptionPane.showInputDialog("Enter total number number you want find maximum..."); n = Integer.parseInt(str); while(i <= n){ str =JOptionPane.showInputDialog("Enter number",i); jTextArea1.append(s tr + "n"); num =Integer.parseInt(str); if (num > max) max = num; i++; } jTextField1.setText(Integer.toString(max)); } Result :
  • 24. 12. Create an application using JButton component to print “Hello NetBeans Programmer” in a message box .note that the message box can be created with the showMessageDialog() method.This method is the instance of Java JOptionPane class.So before using this method add the following line at the top of source: Import javax.swing.JOptionPane; Ans.
  • 25. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { JOptionPane.showMessageDialog(this,"Hello NetBeans Programmer"); } Result : 13. Develop a Java desktop application to demonstrate JOptionPane dialog boxwith differentmessages and opton button. Ans.
  • 26. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int messageType= -2, optionType= -2; String messT = "", optT = ""; if (jRadioButton1.isSelected()){ messageType = -1; messT = "JOptionPane.PLAIN_MESSAGE"; }else if (jRadioButton2.isSelected()){ messageType = 0; messT = "JOptinPane.ERROR_MESSAGE"; }else if (jRadioButton3.isSelected()){ messageType = 1; messT = "JOptionPane.INFORMATION_MESSAGE"; }else if (jRadioButton4.isSelected()){ messageType = 2; messT = "JOptionPane.WARNING_MESSAGE"; } if(jRadioButton5.isSelected()){ optionType = -1; optT = "JOptionPane.DEFAULT_OPTION"; }else if (jRadioButton6.isSelected()){ optionType = 0; optT = "JOptionPane.YES_NO_OPTION"; }else if (jRadioButton7.isSelected()){
  • 27. optionType = 1; optT = "JOptionPane.YES_NO_CANCEL_OPTION"; }else if (jRadioButton8.isSelected()){ optionType = 2; optT = "JOptionPane.OK_CANCEL_OPTION"; } JOptionPane.showConfirmDialog(this, "This message dialog with default OK button.", "JOptionPane Dialog",messageType, optionType); jTextField1.setText(messT + " " + optT); messageType = -2; optionType = -2; } Result :
  • 28. 14. Demonstratethe simple method overloading concepts without using class. Ans.
  • 29. Coding : @SuppressWarnings("unchecked") void show(int roll){ jTextField1.setText(Integer.toString(roll)); } void show(double fees) { jTextField2.setText(Double.toString(fees)); } void show(String name){ jTextField3.setText(name); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { show(100); show(12000.333); show("Ms Nidhi Gupta"); } Result :
  • 30. 15. Create a Java desktop application to perform a password entry system and also see the entry in a message window. Ans.
  • 31. Coding : private void jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) { //Extract a password string into String passW String passW = new String(jPasswordField1.getPassword()); JOptionPane.showMessageDialog(this,passW); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } Result :
  • 32. 16. Develop a Java DesktopApplication to display a message “Hello! I am a Java NetBeans IDE Programmer.”using two commandbuttons Print and Exit. Ans. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { jLabel1.setText("Hello I am a java programmer."); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } Result :
  • 33. 17. Design a GUI application to input any number and print them in reverse order using while statement.Whereas the input number must be positive otherwise display a message containing (“The number must be positive”). Ans. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String str; int value, rDigit; value = 0; while(value <= 0) { value = Integer.parseInt(jButton1.getText()); if(value <= 0) { JOptionPane.showMessageDialog(this,"The number must be positive");
  • 34. break; } } str = ""; while(value!=0){ rDigit = value%10; str = str + Integer.toString(rDigit); value = value /10; } jButton1.setText(str); } Result : 18. Create a GUI application to calculate the simple interest .Using four JLabel, four JTextField and two JButton control s input the principal amount, interest rate and time period.Find the interest amount using Calculate button. Ans.
  • 35. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { double Principal = Double.parseDouble(jTextField1.getText()); double Rate = Double.parseDouble(jTextField2.getText()); double Time = Double.parseDouble(jTextField3.getText()); double SI =(Principal*Rate*Time)/100; jTextField4.setText(""+ SI); } Result :
  • 36. 19. Create GUI Desktop Application to find sum of two numbers using showInputDialog() method. Ans. Coding : private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  • 37. int Fnumber,Snumber,sum; String num1, num2; num1 = JOptionPane.showInputDialog("Enter number"); num2 = JOptionPane.showInputDialog("Enter number"); Fnumber = Integer.parseInt(num1); Snumber = Integer.parseInt(num2); sum = Fnumber = Snumber; JOptionPane.showMessageDialog(null,"The sum of two number is" + sum); } Result :
  • 38. 20. Develop a java Desktop Application to Verify wherther the swapped ATM card accepted password or not. Ans. Coding : private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { System.exit(0); }
  • 39. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String iPass = "mohan 123"; String Epass = new String (jPasswordField1.getPassword()); if(Epass.equals(iPass)){ jTextField3.setText("You are a valid ATM holder"); }else jTextField3.setText("You don't have an account in SBI"); } Result :
  • 40. MYSQL COMMAND QUERIES 1. Write a query to display the TNO, TNAME and salary from TEACHER table. Ans. 2. Write a query to display teacher name and salary for all teacher whose salary is greater than equal to 20000. Ans. 3. Write a query to display the teacher name either ‘Rakesh Sharma’ or ‘Jugal Mittal’. Ans.
  • 41. 4. Write a query to display the teacher information whose salary is not more than 15000. Ans. 5. Write a query to display distinct department no. (dept_no) from TEACHER table. Ans. 6. Write a query to display the teacher no and teacher name whose salary is not in between 15000 and 20000. Ans.
  • 42. 7. Write a query to display TNO,TNAME and SALARY whose salary is more than 18000 using colulmn alias. Ans. 8. Write a query to display TNO, TNAME and SALARY whose salary is more than 18000 using column alias. Ans. 9. Write a query to display TNO, TNAME and ANNUAL salary of all TEACHERS.
  • 43. Ans. 10. Write a query to retrive the first five rows of the table TEACHER. Ans.