Вы находитесь на странице: 1из 11

JAVA QUESTIONS:-

Q.6 Design a GUI application that obtain the price and quantity of an item, calculate the sale value,
discount and net payable amount. Discount is calculated as 10% of sale amount.

int a,b;
a=Integer.parseInt(jTextField1.getText());
b=Integer.parseInt(jTextField2.getText());
int sav,dis,npa;
sav=a*b;
dis=(sav*10)/100;
npa=sav-dis;
jLabel6.setText(""+sav);
jLabel7.setText(""+dis);
jLabel8.setText(""+npa);







Q.7 Design a GUI application that obtains three numbers from the user and dislay largest of three
numbers.


String A,B,C;
A=jTextField1.getText();
B=jTextField2.getText();
C=jTextField3.getText();
Float a,b,c,d,e;
a=Float.parseFloat(A);
b=Float.parseFloat(B);
c=Float.parseFloat(C);
d=(a>b?a:b);
e=(c>d?c:d);
jLabel6.setText(""+e);








Q.8 Design a GUI application to prepare students result. Obtain the Roll, Name and Marks in 05
subjects from the user and calculate the percentage and display division according to the following
conditions:
Per>=60 I
Per>=50 and Per<60 II
Per>=40 and Per<50 III
Else Fail


int a,b,c,d,e;
a=Integer.parseInt(jTextField1.getText());
b=Integer.parseInt(jTextField2.getText());
c=Integer.parseInt(jTextField3.getText());
d=Integer.parseInt(jTextField4.getText());
e=Integer.parseInt(jTextField5.getText());
int per;
per=(a+b+c+d+e)/500*100;

if(per>=60)
{
jLabel9.setText("Your division is First");
}
if((per>=50)&&(per<60))
{
jLabel9.setText("Your division is Third");
}
if((per>=40)&&(per<50))
{
jLabel9.setText("Your division is Fourth");
}
if(per<40)
{
jLabel9.setText("Your division is Fourth");
}
Q.9 Design a GUI application that calculates commission to the salesman, commission is calculated
according to the following rules:
SALES COMMISSION RATE
>3001 15%
22001 30000 10%
12001 22000 07%
5001 12000 03%
<=5000 0%


int sal=Integer.parseInt(jTextField1.getText());
int com=0;
if(sal>3000)
{
com=(sal*15)/100;
}
if((sal>=22001)&&(sal<30000))
{
com=(sal*10)/100;
}
if((sal>=12001)&&(sal<22000))
{
com=(sal*7)/100;
}
if((sal>=5001)&&(sal<12000))
{
com=(sal*3)/100;
}
if(sal<=5000)
{
com=0;
}
jLabel2.setText(""+com);
Q.11 Design a GUI application to find the factorial of a number.

int num=Integer.parseInt(jTextField1.getText());
int fac=1,a;
for(a=1;a<=num;++a)
{
fac=fac*a;
}
jLabel2.setText(""+fac);

Q.13 Design a GUI application to add and delete elements from the listbox.

ADD
DefaultListModel dlm=(DefaultListModel)jList1.getModel();
String a=jTextField1.getText();
dlm.addElement(a);
jList1.setModel(dlm);
DELETE
DefaultListModel dlm=(DefaultListModel)jList1.getModel();
String a=(String)jList1.getSelectedValue();
dlm.removeElement(a);
jList1.setModel(dlm);
MY SQL QUESTIONS:-

Q.1 Create the EMP table based on the following table instance chart:
COLUMN NAME DATA TYPE LENGTH
Empno Number 5
Ename Varchar 20
Sal Number 5
Hiredate Date
Comm Number 5
Deptno Number 5
a) Ename should be unique.
b) Salary must be greater than 4000.
c) Hiredate must not remain Null.

Q.2 Write a query to display ename, salary of those employees who dont have their empno in the
range 6899 to 8977.

Q.4 Display empno and ename of all employee from table Emp.


Q.5 Display ename joined with job with heading Employee, Sal*12 as Total_Salary from table
Emp.

Q.6 Show the structure of table dept.

Q.7 Write a Query to display employee name, salary and department number who are not getting
commission from table Emp.


Q.8 Write a Query to display employee name and salary of those employee who dont have salary in
the range of 15000 and 20000.

Q.9 Write a query to write the name and hire date of all employees who were hired in 1982.

Q.10 Write a Query to display the name of employee whose name contains A as the third alphabet.

Q.11 Write a Query to display the name of employee whose name contains M as first alphabet and
L as third alphabet.


Q.13 Write a Query to modify the salary and increase it by 5000 for all those employee who get
salary less than 10000.

Q.15


Q.17 Write a query that produces display un the following format: <ename> is a <job> has got <sal>
$.

Q.18 Write a query to display the employees having commission>300 in alphabetical order of their
names.

Q.19 Write a query to display the employees having commission>300 in alphabetical order of their
names.

Q.20 Create table Customer as per following Table Instance Chart:
Column Roll Name Add1 CAdd2 Pin CPhone
Datatype number varchar varchar varchar number varchar
Length 7 30 20 30 6 10
a) Add one column Email of datatype varchar and size 30 to the table Customer.
b) Change the datatype of column pincode to varchar (10) in the table Customer.
c) Add one more column Customer income Group of datatype varchar.
d) Insert few records with relevant information un the table.