Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Java Slips Question

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

java slips

slip 1-
sem1
Create an abstract class shape .Derive three classes sphere, cone and cylinder from
it .Calculate area and volume of all (use method overriding)

sem 2
Design an HTML page containing 4 option buttons (Painting, Drawing, Singing
and swimming) and 2 buttons reset and submit. When the user clicks submit, the
server
responds by adding a cookie containing the selected hobby and sends a message
back to
the client. Program should not allow duplicate cookies to be written.
slip 2
sem1
Write a menu driven program to perform the following operations on a set of
integers as shown in the following figure. The load operation should generate 10
random integers (2 digits ) and display the number on the screen .The save
operation should save the numbers to a file “numbers.txt”. The Sort menu provides
various operations and the result is displayed on the screen

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 3
sem 1-
Define a class My Date (Day,Month,Year) with methods to accept and display a
My Date object . Accept date as dd , mm,yyyy . Throw user defined exception
“Invalid Date Exception” if the date is invalid .

Examples of invalid dates:

a. 12 15 2015

b. 31 6 1990

c .29 2 2015

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 4:
sem 1
Write a menu driven program to perform the following operations on a set of
integers as shown in the following figure. The load operation should generate 10
random integers (2 digits ) and display the number on the screen .The save
operation should save the numbers to a file “numbers.txt”. The Sort menu provides
various operations and the result is displayed on the screen

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 5
sem1
Define a class Saving Account (acno ,name ,balance ). Define appropriate
constructors and operation withdraw (), Deposit ()and viewbalance ().the
minimum balance must be 500 .Create an object and perform operations .Raise
user defined “Insufficient Funds Exception” when balance is not sufficient for
withdraw operation .

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 6
sem 1-
Write a program to accept a decimal number In the Textfield .after clicking
Calculate button, program should display the binary, octal, hexadecimal equivalent
for the entered decimal number.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 7
sem1
Create an abstract class shape .Derive three classes sphere, cone and cylinder from
it .Calculate area and volume of all (use method overriding)

sem 2-
Create a table Student with the fields roll number ,name, percentage using
Postgresql .Write a menu driven program (Command line Interface) to perform the
following operations on student table .

a. Insert
b. Modify
c. Delete
d. Search
e. View All
f. Exit
slip 8
sem1:-
Write a program to create the following GUI and apply the changes to the text in
the TextField .

sem 2
Design a servlet which counts how many times a user has visited a web page . If
the user is visiting the page for the first time then display a massage “Welcome”. If
the user is revisiting the page ,then display the number of times page is visited
(Use Cookies)
slip 9
sem1:-
Create an Applet which displays a massage in the center of the screen .The
massage indicates the events taking place on the applet window. Handle events like
mouse click ,mouse moves ,mouse dragged ,mouse pressed .The massage should
update each time an event occurs . The massage should give details of the event
such as which mouse button was pressed (Hint :Use repaint (),Mouse Listener ,
Mouse Motion Listener)

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 10
sem 1
Write a program to implement a simple arithmetic calculator. Perform appropriate
validations.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 11
sem 1
Write a program to accept a string as command line argument and check whether it
is a file or directory .Also perform operations as follows:

a. If it is a directory, list the names of text files .Also, display a count showing

the number of files in the directory.

b. If it is a file display various details of that file.

sem 2
Define a thread called “Print Text Thread” for printing text on command prompt
for ‘n’ number of times. Create three threads and run them. Pass the text and ‘n’ as
parameters to the thread constructor.

Example:

a. First thread prints “I am in FY” 10 times

b. Second thread prints “I am in SY” 20 times

c.Third thread prints “I am in TY”30 times


slip 12
sem 1
Create the following GUI screen using appropriate layout manager .Accept the
name, class hobbies from the user and display the selected options in a text box.

sem 2:-
Write a program to calculate the sum and average of an array of 1000 integers
(Generated randomly) using 10 threads. Each thread calculates the sum of 100
integers.Use these values to calculate average. [Use join method]
slip 13
sem1-
Write a program to accept a string as command line argument and check

Whether it is a file or directory. Also perform operations as follows:

a. If it is a directory, delete all text file in that directory confirm delete


operation from user before deleting text files. Also, display a count showing
the number of files deleted, if any, from the directory.
b. If it is a file display various details of that file.

sem2
Create a table student with fields roll number, name, percentage using postgresql.
Insert values in the table .Display all the details of the student table in a tabular
format on the screen. (Using Swing)
slip 14
sem 1-
Write a menu driven program to perform the following operations on a text file
“phone .txt” Which contains name and phone number pairs. The menu should have
options:

a. Search name and display phone number

b. Add new name-phone number pair.

sem 2
Construct a Linked List containing name of colors: red, blue, yellow and

Orange. Then extend your program to do the following:

a. Display the contents of the list using an Iterator.


b. Display the contents of the list in reverse order using a listIterator.
c. Create another list containing pink and green .Insert the elements of this
list between blue and yellow.
slip 15
sem 1-
Write the program to read item information (id, name, price, qty)from the file
“item.dat’. Write a menu driven program to perform the following operations using
Random access file:

a. Search for a specific item by name


b. Find costliest item
c. Display all item and total cost

sem2
Create a Hash table containing student name and percentage .Display the

Details of the hash table .Also search for a specific and display percentage of
that student.
slip 16
sem1
Define a class cricket player (name, no_ of_ innings, no_ of_ times_ not out, total
_runs, bat_ avg ).Create an array of “n” player object. Calculate the batting average
for each player using a static method avg (). Handle appropriate exception while
calculating average .Define static method “short player” Which short array on the
basis of average .Display the player detail in sorted order.

sem2:-
Create a application to store city names and there STD coded using an

Appropriate collection. Display the GUI should allow the following operations:

a. Add a new city and its code (no duplicated )


b. Remove a city from the collection
c. Search for a city name and display the code
slip 17
sem 1
Define an abstract class “Staff” with member name and address .Define two sub-
class of this class - “Fulltimestaff” or (department, salary) and part time
staff (number _of_ hours ,rate _per_ hour).Define appropriate constructors.

Create “n” object which could be of either FullTimeStaff or PartTimeStaff class


asking the user’s choice .Display details of all “FullTimeStaff” object and all
PartTimeStaff object.

sem 2
Design the table Login (login_ name, password) using Postgreql . Also design an
HTML login screen accepting the login name and the password for the user .write
a servlet program that validates accepted login name and pass

word entered by user from the login table you have created. The servlet sends back
an appropriate response.
slip 18
sem 1
Define a class my number having one positive integer data member .Write a
difficult constructer to initialize it to 0 and other constructor to initialize it to a
value (Use this ).Write a method is Negative ,isZero, isOdd , isEven. Create an
object in main . Use command line adguments to pass a value to the object and
perform the above test

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 19

sem1:-
. Create a Applet which display a massage in the center of the screen . the massage
indicated the events taking place on the applet window .Handle various keyboard
related event .The massage should update each time an event occurs. The massage
should give details of the event such as which key was pressed, released, typed etc.

(Hint: Use repaint (), key listener ).

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 20
sem 1-
Write a program to create a package “SY” which has a class SY Marks (computer
total, maths total, Electronics total) create another package “TY” Which has a class
TY marks (theory ,Practical ). Create “n” objects of Student class having roll
number, name, SYM Marks and TYM Marks. Add the marks of SY and TY
computer subjects and calculate grade (‘A’ for>=70, ‘B’ for>=60, ‘C’ for>=50,
“Pass Class” for>=40 else “Fail” ) and display the result of the student in proper
format.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 21
sem 1
Define a Student class (roll number, name, percentage).Define a default and
parameterized constructor. Keep a count of objects created. Create objects using
parameterized constructor and display the object count after each object is created.
(Use static member and method). Also display the contents of each object. Modify
program to create “n” objects of the Student class. Accept details for each object.
Define static method “sort Student” which sorts the array on the basis of
percentage.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 22:-
sem1:-
Write a menu driven program to perform the following operations. Accept
operation accept the two numbers using input dialog box. GCD will compute the
GCD of two numbers and display it in message box and Power operation will
calculate the value of an and display it in message box where “a” and “n” are two
inputted values.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 23
sem 1
Create an interface “CrediteCardInterface” with methods: view credit amount (),
use Card(),pay Card (),and increaseLimit(). Create a class “SilverCardCustemer”
(name, card number (16 digit),credit amount –initialized to 0 ,credit Limit –set to
50000 ) which implements above interface . Inherit class GoldCardCustmer from
SilverCardCustemer having same methods but credit Limit of 100000 .Create an
object of each class and perform operations .Display appropriate a massages for
success or failure of transaction (Use method overriding)

a. Use Card ()method increases the credit Amount by a specific amount up to

Credit Limit.

b .Pay Credit () reduces the credit Amount by a specific amount .

c. Increase Limit () increases the credit Limit for a Gold Card Customer (only
3

Times, not more than 5000 rupees each time)

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 24
sem 1
write a program to create a super class Vehicle having members Company and
price. Derive two different classes Light Motor Vehicle (mileage) and Heavy
motor Vehicle (capacity _in_ tons). Accept the information for “n” vehicles and
display the information in appropriate form. While taking data, asked user about
the type of vehicle first.

sem 2
Accept “n” integers from the user and store them in a collection .Display them in
the sorted order .The collection should not accept duplicate elements (Use suitable
collection ).search for a particular element using predefined search method in the
collection framework .
slip 25
sem 1
Define a class employee having private menmbers int id,name,dept,salary.Define
default and parametrised cTOR.create a subclass called manager with private
member bonus.Define methods accept and display in both the classes.create n
objects of manager class & display the details of manager having maximum total
salary=salary+bonus.

sem 2
Write a program to create a shopping mall. User must be allowed to do purchase
from two pages. Each page should have a page total. The third page should display
a bill, which consists of a page total of what ever the purchase has been done and
print the total. (Use HttpSession)

You might also like