Design a Java Netbeans 6.5.1 GUI application to find the maximum number between the two numbers.

Q8. Design a Java Netbeans 6.5.1 GUI application to find the maximum number between the two numbers.

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnMax, button, below the line that says, ‘// TODO add your handling code here’

 

int x,y;

x=Integer.parseInt(txt1.getText());

y=Integer.parseInt(txt2.getText());

if(x>y)

lblmax.setText(x+””);

else

lblmax.setText(y+””);

}

OUTPUT:

Design Java Netbeans 6.5.1 GUI application to find out that entered number is EVEN or ODD.

Q7. Design Java Netbeans 6.5.1 GUI application to find out that entered number is EVEN or ODD.

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnFind, button, below the line that says, ‘// TODO add your handling code here’

int num;

num=Integer.parseInt(txt1.getText());

if(num%2==0)

lblmsg.setText(“Number is EVEN.”); Read More …

Java NetBeans GUI application to calculate salary of employee.

Q6. Design a Java NetBeans GUI application to calculate salary of employee.

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnCal, button, below the line that says, ‘// TODO add your handling code here’

 

double sal,da,ta,hra,cca;

sal=Double.parseDouble(txtsal.getText()); Read More …

Java Netbeans Application To Find Out Total, Percentage Of Any Three Subjects.

Q5. Design a GUI application to find out Total, Percentage of any three subjects (Subject marks not more than 100).

Sol:

Create a GUI application as per following screenshot.

Type the following code by double clicking BtnTot, button, below the line that says, ‘// TODO add your handling code here’ Read More …

Display Information of Student in I-Card Format in Java Netbeans 6.5.1.

Q4. Design a Java Netbeans 6.5.1 GUI application that asks for some information about a student and display it in I-card format.

Sol:

Create a GUI application as per following screenshot.

 

Type the following code by double clicking BtnAdd, button, below the line that says, ‘// TODO add your handling code here’

String t1=txtTitle.getText();    //text of txtTitle stored in t1.

String t2=txtName.getText();    //text of txtTitle stored in t2.

String t3=txtLname.getText();    //text of txtTitle stored in t3.

String t4=txtClass.getText();   //text of txtTitle stored in t4.

String t5=txtSec.getText();    //text of txtTitle stored in t5.

 

repArea.append(“Student Details:” + “\n”);    //text will be added to textarea

repArea.append(“Name:” + t1 + ” ” + t2 + ” ” + t3 + “\n”);

repArea.append(“Class:” + t4 + ” ” + t5);

 

Output of the above program will be:

Write a C++ program to accept percentage and print division accordingly.

Q22. Write a C++ program to accept percentage and print division accordingly.

Solution:

#include<iostream.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int per;

 

clrscr(); //for clearing the screen

 

cout<<“\n Enter the percentage: “;

cin>>per;

 

per>=60? cout<<“\n I Division.” : per<60&&per>=45? cout<<“\n II Division.” :per>=36? cout<<“\n III Division.” : cout<<“\n Fail.”;

 

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

 

OUTPUT:

CASE 1:

Enter the percentage: 78

 

I Division.

 

CASE 2:

Enter the percentage: 57

 

II Division.

 

CASE 3:

Enter the percentage: 33

 

Write a C++ program to accept a number and if it is less than 50 and greater than 20 than print its square value.

Q21. Write a C++ program to accept a number and if it is less than 50 and greater than 20 than print its square value.

Solution:

#include<iostream.h> //standard input/output header file

#include<conio.h> //for clrscr()

 

int main()

{

int a;

 

clrscr(); //for clearing the screen

 

cout<<“\n Enter a number: “;

cin>>a;

 

a<50&&a>20? cout<<“\n The square of number is “<<a*a<<“.” : cout<<“\n The number is “<<a<<“.”;

 

getch(); //holds the screen until any key is pressed

return 0; //makes main() finish

}

 

 

OUTPUT:

CASE 1:

Enter a number: 45

 

The square of number is 2025.

 

CASE 2:

Enter a number: 78

 

The number is 78.