XII IT Practical File Content
XII IT Practical File Content
SELECT ROLLNO,NAME,DOB
WHERE DOB BETWEEN ‘1999-01-01’ AND ‘2000-12-31’
7. Take the percentage of a student. If the percentage is greater than 60 then print “Pass”
otherwise print “Work Hard”
Take marks in 5 subjects. Then calculate the percentage and print the remark based on it:
% Remark
>=80 Excellent
>=60 and <80 Very Good
>=40 and <60 Good
<40 Work Hard
13. Ask the user to enter a number between 0 and 6. If the entered number is 0 , the message
“It is Sunday” should be displayed. If the entered number is 1, the message “It is Monday”
should be displayed and so on. Use switch case statement.
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner user_input=new Scanner(System.in);
System.out.println("Enter a Number");
int num;
num=user_input.nextInt();
switch(num)
{
case 0:System.out.println("It is Sunday");
break;
case 1:System.out.println("It is Monday");
break;
case 2:System.out.println("It is Tuesday");
break;
case 3:System.out.println("It is Wednesday");
break;
case 4:System.out.println("It is Thursday");
break;
case 5:System.out.println("It is Friday");
break;
case 6:System.out.println("It is Saturday");
break;
}
System.out.println("Program Ends");
}
}
LOOPS
import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
int num,sum=0,count=0; double avg;
Scanner user_input=new Scanner(System.in);
System.out.println("Enter a limit");
num=user_input.nextInt();
for(int i=2;i<=num;i=i+2)
{
sum+=i;
count++;
}
avg=sum/count;
System.out.println("The average is "+avg);
}
}
ARRAYS
19. Calculate the volume of a cube by sending length, breadth and height to a function for
calculation.
public class Main
{
static double volume(double l,double b,double h)
{
return l*b*h;
}
public static void main(String[] args) {
CLASS
20. Design a class book. Display details of a book using Constructor.
class Book
{
String bname;
String author;
double price;
23. THREAD