0% found this document useful (0 votes)
5 views

solution

Uploaded by

mansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

solution

Uploaded by

mansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Q.1.

SQL QUERY
a) CREATE table BOOK (BOOKID INTEGER(6) PRIMARY KEY, SUBJECT
VARCHAR(30), BOOKPRICE TINY INTEGER);
b) INSERT INTO BOOK VALUES (1001, “MATH”, 460);
INSERT INTO BOOK VALUES (1001, “SCIENCE”, 490);
INSERT INTO BOOK VALUES (1001, “INFORMATION TECHNOLOGY”, 450);
c) SELECT * FROM BOOK WHERE BOOKID=1003;
d) DELETE FROM BOOK WHERE BOOKID=1001;
e) UPDATE BOOK SET BOOKPRICE=525 WHERE BOOKID=1002;
Q. 2.
import java.util.Scanner;
public class AreaOfRectangle {
public static void main(String args[]){
int length, breadth, area;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the length of the rectangle ::");
length = sc.nextInt();
System.out.println("Enter the breadth of the rectangle ::");
breadth = sc.nextInt();
area = length* breadth;
System.out.println("Area of the rectangle is ::"+area);
}
}
public class AreaOfRectangle {
public static void main (String args[]) {
System.out.println("Enter the length of the rectangle ::");
int length=Integer.parseInt(jTextField1.getText());
System.out.println("Enter the breadth of the rectangle ::");
int length=Integer.parseInt(jTextField2.getText());
area = length * breadth;
System.out.println (“Area of the rectangle is : : “+area);
Q. 3.
import java.util.Scanner;
public class EvenOdd {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = reader.nextInt();
if(num % 2 == 0)
System.out.println(num + " is even");
else
System.out.println(num + " is odd");
}
}

public class EvenOdd {


public static void main(String[] args) {
System.out.print("Enter a number: ");
int num = Integer.parseInt(jTextField1.getText());
if(num % 2 == 0)
System.out.println(num + " is even");
else
System.out.println(num + " is odd");
}
}

You might also like