## Students Result in JAVA NETBEANS IDE 6.5.1

Q15. Design an application in JAVA NETBEANS IDE 6.5.1 to prepare students result on the basis of marks entered.

Sol:

Create a GUI application as per following screenshot.

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

jTextField1.setText(“”);

jTextField2.setText(“”);

jTextField3.setText(“”);

jTextField4.setText(“”);

jTextField5.setText(“”);

jTextField6.setText(“”);

## 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<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 take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Q15. Write a C++ program to take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Solution:

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

int main()

{

int Phy,Chem,Maths,total,per;

clrscr(); //for clearing the screen

cout<<“\n Enter the marks of Physics: “;

cin>>Phy;

cout<<“\n Enter the marks of Chemistry: “;

cin>>Chem;

cout<<“\n Enter the marks of Math’s: “;

cin>>Maths;

total=Phy+Chem+Maths;

per=total/3;

cout<<“\n Total= “<<total;

cout<<“\n Percentage= “<<per<<“%”;

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

return 0; //makes main() finish

}

OUTPUT:

Enter the marks of Physics: 78

Enter the marks of Chemistry: 89

Enter the marks of Math’s: 90

Total= 257

Percentage= 85%

## C program to accept percentage and print division accordingly.

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

Solution:

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

int main()

{

int per;

clrscr(); //for clearing the screen

printf(“\n Enter the percentage: “);

scanf(“%d”,&per);

per>=60?printf(“\n I Division.”) : per<60&&per>=45?printf(“\n II Division.”):per>=36?printf(“\n III Division.”) : printf(“\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

Fail

## C Program To Take Input In Three Subjects Physics, Chemistry And Math’s And Calculate The Total And Percentage.

Q15. Write a C program to take input in three subjects Physics, Chemistry and Math’s and calculate the total and percentage.

Solution:

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

int main()

{

int Phy,Chem,Maths,total,per;

clrscr(); //for clearing the screen

printf(“\n Enter the marks of Physics: “);

scanf(“%d”,&Phy);

printf(“\n Enter the marks of Chemistry: “);

scanf(“%d”,&Chem);

printf(“\n Enter the marks of Math’s: “);

scanf(“%d”,&Maths);

total=Phy+Chem+Maths;

per=total/3;

printf(“\n Total= %d”,total);

printf(“\n Percentage= %d%”,per);

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

return 0; //makes main() finish

}

OUTPUT:

Enter the marks of Physics: 78

Enter the marks of Chemistry: 89

Enter the marks of Math’s: 90

Total= 257

Percentage= 85%