0% found this document useful (0 votes)
2 views3 pages

Java Lab Internal

The document outlines a series of Java programming assignments covering various concepts such as primitive data types, quadratic equations, classes and inheritance, interfaces, threading, file handling, networking, and GUI applications. Each section contains specific tasks, including writing programs for race qualifications, payroll processing, and creating applets. The assignments are designed to enhance understanding of Java programming and its applications in real-world scenarios.

Uploaded by

Nikhil ES
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)
2 views3 pages

Java Lab Internal

The document outlines a series of Java programming assignments covering various concepts such as primitive data types, quadratic equations, classes and inheritance, interfaces, threading, file handling, networking, and GUI applications. Each section contains specific tasks, including writing programs for race qualifications, payroll processing, and creating applets. The assignments are designed to enhance understanding of Java programming and its applications in real-world scenarios.

Uploaded by

Nikhil ES
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/ 3

Java Lab internal

List of programs:

1. a). Write a JAVA program to display default value of all primitive data
type
of JAVA
b). Write a java program that display the roots of a quadratic equation
ax2+bx=0. Calculate the discriminate D and basing on value of D, describe
the nature of root.
c). Five Bikers Compete in a race such that they drive at a constant
speed
which may or may not be the same as the other. To qualify the race, the
speed of a racer must be more than the average speed of all 5 racers.
Take as
input the speed of each racer and print back the speed of qualifying
racers.
d) Write a case study on public static void main(250 words)

2. a). Write a program to create a class named shape. In this class we have
three
sub classes circle, triangle and square each class has two member
function
named draw () and erase (). Create these using polymorphism concepts.
b). Write a program to create a room class, the attributes of this class is
roomno, roomtype, roomarea and AC machine. In this class the member
unctions are setdata and displaydata.

3. a). Write a program to create interface A in this interface we have two


method
meth1 and meth2. Implements this interface in another class named
MyClass.
b). Write a program to create interface named test. In this interface the
member function is square. Implement this interface in arithmetic class.
Create one new class called ToTestInt in this class use the object of
arithmetic class.
c). Create an outer class with a function display, again create another
class
inside the outer class named inner with a function called display and call
the
two functions in the main class.

4. a). Write a JAVA program that creates threads by extending Thread


class
.First thread display “Good Morning “every 1 sec, the second thread
displays
“Hello “every 2 seconds and the third display “Welcome”every 3 seconds
,(Repeat the same by implementing Runnable)
b). Write a program illustrating isAlive and join ()

5. a). Write a Java program to perform employee payroll processing


using packages. In the java file, Emp.java creates a package employee
and creates a class Emp. Declare the variables name,empid, category,
bpay, hra, da, npay, pf, grosspay, incometax, and allowance. Calculate
the values in methods. Create another java file Emppay.java. Create
an object e to call the methods to perform and print values.
b). Write a Package MCA which has one class Student. Accept
studentdetail through parameterized constructor. Write display () method to
display details. Create a main class which will use package and
calculate total marks and percentage.

6. a). Write a complex program to illustrate how the thread priorities? Imagine
that the first thread has just begun to run, even before it has a chance to
do
anything. Now comes the higher priority thread that wants to run as well.
Now the higher priority thread has to do its work before the first thread
starts.
b). Write a Java program that implements producer consumer problem
using
the concept of inter thread communication.

7. a). Write a program to create a text file in the path c:\java\abc.txt


and check whether that file is exists. Using the command exists(),
isDirectory(), isFile(), getName() and getAbsolutePath().
b) Write a program to rename the given file, after renaming the
file delete the renamed file. (Accept the file name using command
line arguments.)
c ) Write a program to create a directory and check whether the
directory is created.

8. a). Write a program that can read a host name and convert it to an IP
address
b). Write a Socket base java server program that responds to client
messages as follows: When it receives a message from client, it
simply converts the message into all uppercase letters and sends back to
the client. Write both client and server programs demonstrating this.

9. a). Create the classes required to store data regarding different types of
courses that employees in a company can enroll for. All courses have
name
and course fee. Courses are also either classroom delivered or delivered
online. Courses could also be full time or part time. The program must
enable the course coordinator to register employees for courses and list
out
employees registered for specific courses.
b). Write a java program in to create a class Worker. Write classes
DailyWorker and SalariedWorker that inherit from Worker. Every worker
has a name and a salaryrate. Write method Pay (int hours) to compute the
week pay of every worker. A Daily worker ia paid on the basis of the
number
of days she/he works. The salaried worker gets paid the wage for 40 hours
a
week no matter what the actual hours are. Test this program to calculate
the
pay of workers.

10. a). Write a JAVA program to paint like paint brush in applet.
b) Write a JAVA program to display analog clock using Applet.
c). Write a JAVA program to create different shapes and fill colors using
Applet.

11. a). Write a JAVA program to build a Calculator in Swings


b). Write a JAVA program to display the digital watch using swings.

You might also like