HEMCHANDRACHARYA NORTH GUJARAT UNIVERSITY, PATAN Programme code : BBCAO Programme Name : BCA Course Code BBCAO501PR Semester : 5 JAVA Programming(PRJ) Course type : Practical Total Credit : 04 Teaching time (hours) Examination Marking scheme Theory (hrs) Practical (hrs) Internal (Marks) External (Marks) Total (Marks) 4 X 15 = 60 30 70 ( Paper of 3 hrs) 100 Practical List 1 Write a Java Program find the area of circle. 2 Write a Java Program that will display factorial of the given number. 3 Write a Java Program that will find the largest no from the given two nos. 4 Write a Java Program that will find the largest no from the given three nos. 5 Write a Java Program that shows the use of switch Statement. 6 Write a Java Program to find the sum of the digits of given number. 7 Write a Java Program that will display the Sum of 1+1/2+1/3…..+1/n. 8 Write a Java Program that check weather the given no is prime or not. 9 Write a Java Program that implements the use of break statement. 10 Write a Java Program that implements the use of continue statement. 11 Write a Java Program that will accept Command-line Arguments and display the same. 12 Write a Java Program to sort the elements of an array in Ascending Order. 13 Write a Java Program to create a Student class and generate result of student (Total, Per,Grade). 14 Write a Java Program to create an Employee class and generate Salary Slip for the employee. 15 Write a java program which shows the use of Static Members. 16 Write a java program which shows the Nesting of Methods. 17 Write a java program which shows the use of Methods Overloading. 18 Write a java program which implements the Default Constructors. 19 Write a java program which implements the Parameterized Constructors. 20 Write a java program which implements the Overloading of Constructors. 21 Write a java program which explains the concept of Single Inheritance. 22 Write a java program which explains the concept of Multilevel Inheritance. 23 Write a java program which explains the concept of Hierarchical Inheritance. 24 Write a java program which shows the Method Overriding. 25 Write a Java Program to implement final class and final method. 26 Write a Java Program to implement abstract class and abstract method. 27 Write a java program which implements Interface. 28 Write a java program which implements Multiple Interfaces. 29 Write a java program which shows importing of classes from other packages. 30 Write a Java Program to implement the methods of Math Class. 31 Write a Java Program to implement the methods of String Class. 32 Write a Java Program to implement the methods of Vector Class. 33 Write a Java Program to implement the methods of Stack Class. 34 Write a Java Program which will read a text and count all occurrences of a particular word. 35 Write a Java Program which will read a string and rewrite it in the alphabetical order eg. The word “STRING” should be written a “GINRST”. 36 Write a java program which creates threads using the Thread Class. 37 Write a java program which shows the use of yield(), stop() and sleep() Methods. 38 Write a java program which shows the Priority in Threads. 39 Write a java program which use of Runnable Interface. 40 Write a java program which uses try and catch for Exception Handling.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
HEMCHANDRACHARYA NORTH GUJARAT UNIVERSITY, PATANProgramme code : BBCAO Programme Name : BCACourse Code BBCAO501PR Semester : 5
JAVA Programming(PRJ)Course type : Practical Total Credit : 04Teaching time (hours) Examination Marking scheme
Theory(hrs)
Practical(hrs)
Internal(Marks)
External(Marks)
Total(Marks)
4 X 15 = 60 30 70 ( Paper of 3 hrs) 100
Practical List1 Write a Java Program find the area of circle.2 Write a Java Program that will display factorial of the given number.3 Write a Java Program that will find the largest no from the given two nos.4 Write a Java Program that will find the largest no from the given three nos.5 Write a Java Program that shows the use of switch Statement.6 Write a Java Program to find the sum of the digits of given number.7 Write a Java Program that will display the Sum of 1+1/2+1/3…..+1/n.8 Write a Java Program that check weather the given no is prime or not.9 Write a Java Program that implements the use of break statement.10 Write a Java Program that implements the use of continue statement.11 Write a Java Program that will accept Command-line Arguments and display the same.12 Write a Java Program to sort the elements of an array in Ascending Order.13 Write a Java Program to create a Student class and generate result of student (Total, Per,Grade).14 Write a Java Program to create an Employee class and generate Salary Slip for the employee.15 Write a java program which shows the use of Static Members.16 Write a java program which shows the Nesting of Methods.17 Write a java program which shows the use of Methods Overloading.18 Write a java program which implements the Default Constructors.19 Write a java program which implements the Parameterized Constructors.20 Write a java program which implements the Overloading of Constructors.21 Write a java program which explains the concept of Single Inheritance.22 Write a java program which explains the concept of Multilevel Inheritance.23 Write a java program which explains the concept of Hierarchical Inheritance.24 Write a java program which shows the Method Overriding.25 Write a Java Program to implement final class and final method.26 Write a Java Program to implement abstract class and abstract method.27 Write a java program which implements Interface.28 Write a java program which implements Multiple Interfaces.29 Write a java program which shows importing of classes from other packages.30 Write a Java Program to implement the methods of Math Class.31 Write a Java Program to implement the methods of String Class.32 Write a Java Program to implement the methods of Vector Class.33 Write a Java Program to implement the methods of Stack Class.34 Write a Java Program which will read a text and count all occurrences of a particular word.35 Write a Java Program which will read a string and rewrite it in the alphabetical order eg. The word
“STRING” should be written a “GINRST”.36 Write a java program which creates threads using the Thread Class.37 Write a java program which shows the use of yield(), stop() and sleep() Methods.38 Write a java program which shows the Priority in Threads.39 Write a java program which use of Runnable Interface.40 Write a java program which uses try and catch for Exception Handling.
41 Write a java program which uses Multiple catch Blocks.42 Write a java program which uses finally Statement.43 Write a java program which uses Nested try Statements.44 Write a java program which shows throwing our own Exception.45 Create an Applet program that print Hello Applet.46 Create an applet that use init(),start(),stop() and destroy() methods of applet.47 write an applet program to implement the concept of passing parameter to applet.48 Write a applet program to implement various methods of Graphics class.
Practical Exam Scheme:Program Output Viva Journal Total25 Marks 15 Marks 20 Marks 10 Marks 70 Marks
Practical:1
Write a Java Program find the area of circle.
import java.util.*;
public class pr1
{
public static void main(String args[])
{
int r;
Scanner s=new Scanner(System.in);
r=s.nextInt();
double area=Math.PI*(r*r);
System.out.println("the area of circle is:"+area);
}
}
Output:1
Stud:-Mehul patel Page:3
Practical :2
Write a Java Program that will display factorial of the given number.
import java.util.*;
public class pr2fact
{
public static void main(String args[])
{
int n,c,fact=1;
Scanner s=new Scanner(System.in);
n=s.nextInt();
if(n<0)
System.out.println("number should be non nagative.");
else
for(c=1;c<=n;c++)
fact=fact*c;
System.out.println("Factorial of "+n+" is="+fact);
}
}
Output:2
Stud:-Mehul patel Page:4
Practical :3
Write a Java Program that will find the largest no from the given two nos.
Import java.util.Scanner;
public class pr3large2
{
public static void main(String args[])
{
int x,y,n;
System.out.println("enter two integers:");
Scanner input=new Scanner(System.in);
x=input.nextInt();
y=input.nextInt();
if(x>y)
System.out.println("x is largest:");
else
System.out.println("y is largest:");
}
}
Output:3
Stud:-Mehul patel Page:5
Practical:4
Write a Java Program that will find the largest no from the given three nos.
Import java.util.Scanner;
public class pr4large3
{
public static void main(String args[])
{
int x,y,z;
System.out.println("enter three integers:");
Scanner input=new Scanner(System.in);
x=input.nextInt();
y=input.nextInt();
z=input.nextInt();
if(x>y && x>z)
System.out.println("x is largest:");
else if(y>x && y>z)
System.out.println("y is largest:");
else
System.out.println("z is largest:");
}
}
Stud:-Mehul patel Page:6
Output:4
Stud:-Mehul patel Page:7
Practical:5
Write a Java Program that shows the use of switch Statement.
import java.util.*;
public class pr5
{
public static void main(String args[])
{
int no;
//no=Integer.parseInt(args[0]);
Scanner s=new Scanner(System.in);
System.out.println("enter value between 1 to 12");
no=s.nextInt();
switch(no)
{
case 1:
System.out.println("january");
break;
case 2:
System.out.println("february");
break;
case 3:
System.out.println("march");
break;
case 4:
System.out.println("April");
break;
Stud:-Mehul patel Page:8
case 5:
System.out.println("May");
break;
case 6:
System.out.println("June");
break;
case 7:
System.out.println("July");
break;
case 8:
System.out.println("August");
break;
case 9:
System.out.println("September");
break;
case 10:
System.out.println("October");
break;
case 11:
System.out.println("November");
break;
Stud:-Mehul patel Page:9
case 12:
System.out.println("Decmber");
break;
default:
System.out.println("enter number between 1 to 12");break;
}
}
}
Output:5
Stud:-Mehul patel Page:10
Practical:6
Write a Java Program to find the sum of the digits of given number
Import java.util.Scanner;
public class pr6sum
{
public static void main(String args[])
{
Scanner sc=new Scanner (System.in);
System.out.println("please enter number for calculate sum of digits:");
int number=sc.nextInt();
int sum=0;
int input=number;
while(input!=0)
{
int lastdigit=input%10;
sum+=lastdigit;
input/=10;
}
System.out.printf("sum of digit of numbers %d is %d",number,sum);
}
}
Stud:-Mehul patel Page:11
Output:6
Stud:-Mehul patel Page:12
Practical:7
Write a Java Program that will display the Sum of 1+1/2+1/3…..+1/n.
import java.util.*;
public class pr7
{
public static void main(String args[])
{
int n,i;
float sum=0;
Scanner s=new Scanner(System.in);
n=s.nextInt();
for(i=1;i<=n;i++)
{
sum=sum+(float)1/i;
}
System.out.println("\nsum="+sum);
}
}
Stud:-Mehul patel Page:13
Output:7
Stud:-Mehul patel Page:14
Practical :8
Write a Java Program that check weather the given no is prime or not
import java.util.*;
public class pr8
{
public static void main(String args[])
{
int i,n,flag=0;
Scanner s=new Scanner(System.in);
System.out.print("Enter Nuuber for check no prime or not=");
n=s.nextInt();
//n=Integer.parseInt(args[0]);
for(i=2;i<n;i++)
{
if(n%2==0)
{
flag=1;
}
else
{
flag=0;
}
}
if(flag==1)
Stud:-Mehul patel Page:15
{
System.out.println("Number Is Not Prime");
}
else
{
System.out.println("Number Is Prime");
}
}
}
Output:8
Stud:-Mehul patel Page:16
Practical :9
Write a Java Program that implements the use of break statement
public class pr9
{
public static void main(String args[])
{
int n=10,i=1;
while(i<=n)
{
System.out.println("value of i is="+i);
if(i==5)
{
break;
}
i=i+1;
}
}
}
Stud:-Mehul patel Page:17
Output:9
Stud:-Mehul patel Page:18
Practical :10
Write a Java Program that implements the use of continue statement.
public class pr10
{
public static void main(String args[])
{
int n=10,i=0;
while(i<n)
{
i=i+1;
if(i==5)
{
continue;
}
System.out.println("value of i is="+i);
}
}
}
Stud:-Mehul patel Page:19
Output:10
Stud:-Mehul patel Page:20
Practical:11
Write a Java Program that will accept Command-line Arguments anddisplay the same.
public class pr11
{
public static void main(String args[])
{
System.out.println("Command line argument is:"+args.length);
System.out.println("Array index 0 value is:"+args[0]);
System.out.println("Array index 1 value is:"+args[1]);
}
}
Output:11
Stud:-Mehul patel Page:21
Practical :12
Write a Java Program to sort the elements of an array in Ascending Order.
public class pr12
{
public static void main(String args[])
{
int number[]={55,40,80,65,71};
int n=number.length;
System.out.println(" ");
System.out.print("Given list:");
for(int i=0;i<n;i++)
{
System.out.print(" "+number[i]);
}
System.out.print("\n");
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(number[i]<number[j])
{
int temp=number[i];
number[i]=number[j];
number[j]=temp;
}
Stud:-Mehul patel Page:22
}
}
//System.out.println(" ");
//System.out.print("Decending Sorted list");
//for(int i=0;i<n;i++)
//{
// System.out.print(" "+number[i]);
//}
System.out.println(" ");
System.out.print("Accending Sorted list:");
for(int i=n-1;i>=0;i--)
{
System.out.print(" "+number[i]);
}
System.out.println(" ");
}
}
Output:12
Stud:-Mehul patel Page:23
Practical:13
Write a Java Program to create a Student class and generate result ofstudent (Total, Per,Grade).