JAVA PROGRAMMING
Java is a powerful general-purpose object oriented programming language. It is used to develop both desktop and mobile applications. According to Oracle, the company that owns Java, Java runs on 3 billion devices worldwide, which makes Java one of the most popular programming languages.
This Java tutorial will guide you to learn Java.
Dr.K.PAZHANIKUMAR
Pazhanikumar holds a Ph.D. in Computer Application from Manonmaniam Sundaranar University,Tirunelveli. His research interests and work experience spans the area of Data mining. Dr. Pazhanikumar works as a faculty member at the Department of Science at S.T.Hindu College,Nagercoil.
INTENDED AUDIENCE : The UG and PG students from the Computer Science or Computer Application disciplines namely Bsc(CS),BCA,MSc(CS),MCA, etc. might be interested for this course.
PREREQUISITES : This course requires that the students are familiar with programming language such as C/C++ and data structures, algorithms.
COURSE LEVEL
UG & PG
COURSE LAYOUT
Week-1
Day-1
Introduction
Features of JAVA
Day-2
Characteristics of OOP
Simple Java Application
Day-3
Data Types
Variables
Constant
Type Conversion
Day-4
Operators
Day-5
Control Statements
Day-6
Arrays
Assignment
1. Write a program to
the find the following 1 Prime number checking 2 Sum of digit
2. Write
a program to calculate the roots of Quadratic equations.
3. Write a java
application program to find NCR(Use recursive function)
4. Write a java
application program to check the given no is Armstrong or not. (153=13+53+33)
5. Write a java
application program to count no of even and odd digit in a given no.(Ex:Given
no:23876 No of Even digits:3(2,8,6) Odd digits:2(3,7).
6. Write a java program to sort the numbers in ascending order.
7. Write a java application program for 1.Matrix Addition 2,Matrix Subtraction
8. Write a java program to generate fibonacci series.
9. Write a java program to generate multiplication table.
10. Write a java program to demonstrate the use of break and continue statement.
Week-2
Day-1&2
Class
Day-3
Constructor
Garbage Collection and Finalize Method
Day-4
Access Specifiers
Day-5
Method Overloading
Day-6
Static Members
Assignment
1.Write a program to
create a room class, the attributes of this class isroomno, roomtype, roomarea
and ACmachine. In this class the member functions are setdata and displaydata.
2.Develop
a Java application to generate Electricity bill. Create a class with the
following members: Consumer no., consumer name, previous month reading, current
month reading, type of EB connection (i.e domestic or commercial). Compute the
bill amount using the following tariff. If the type of the EB connection is
domestic, calculate the amount to be paid as follows: 9 First 100 units - Rs. 1
per unit 9 101-200 units - Rs. 2.50 per unit 9 201 -500 units - Rs. 4 per unit
9 > 501 units - Rs. 6 per unit If the type of the EB connection is
commercial, calculate the amount to be paid as follows: 9 First 100 units - Rs.
2 per unit 9 101-200 units - Rs. 4.50 per unit 9 201 -500 units - Rs. 6 per
unit 9 > 501 units - Rs. 7 per unit.
3.Create
class point with following instance variable and methods. Instance variable:
private int x,y Constructors : public Point(), Point(int x, int y) Methods :
public void setX(int x), setY(int y), setXY(int x, int y)
4.
Create class Number with only one private instance variable as a int primitive type. To include the following methods (include respective
constructors) isZero( ), isPositive(), isNegative( ), isOdd( ), isEven( ),
isPrime(), isAmstrong() the above methods return boolean primitive type.
getFactorial(), getSqrt(), getSqr(), sumDigits(), getReverse() the above methods
return int/double primitive type.
Week-3
Day-1
Inheritance
Day-2
Method Overriding - Super Keyword
Day-3
Abstract Method & Class
Day-4
Interface
Final Method and Final Class
Day-5&6
Package & Access Specifiers
Assignment
1.Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund. Generate pay slips for the employees with their gross and net salary.
2.Create a class called Publication which stores title and price of a publication. From this class derive two classes called Book and CD.Book class adds page no.CD class adds playing time.Each of these three classes should have constructor and display().Write a java application program to implement this.
3.Create a class named Person having the following members:
Data members
1 - Name
2 - Age
3 - Phone number
4 - Address
5 – Salary
It also has a method named printSalary() which prints the salary of the members. Two classes Employee,Manager inherits the Person class. The Employee and Manager classes have data members specialization and department respectively. Now, assign name, age, phone number, address and salary to an employee and a manager by making an object of both of these classes and print the same.
4. Create a class named Rectangle with two data members length and breadth and two methods to print the area and perimeter of the rectangle respectively. Its constructor having parameters for length and breadth is used to initialize length and breadth of the rectangle. Let class Square inherit the Rectangle class with its constructor having a parameter for its side (suppose s) calling the constructor of its parent class as super(s,s). Print the area and perimeter of a rectangle and a square.
5. Create a class named Shape with a method to print This is shape. Then create two other classes Rectangle, Circle inheriting the Shape class, both having a method to print This is rectangular shape and This is circular shape respectively. Create a subclass Square of Rectangle having a method to print Square is a rectangle. Now call the method of Shape and Rectangle class by the object of Square class.
6. Create an abstract class Pen with methods write() and refill() as abstract methods.From this class, create a concrete class FountainPen with additional method change Nib().Write a java application program to implement this.
7.Create a class Telephone with lift() and disconnected() methods as abstract methods.Create a class SmartTelephone which extends Telephone. Write a java application program to implement this.
8. Create an Interface TVRemote and use it to inherit another Interface SmartTVRemote Create a class TV which implements SmartTVRemote. Write a java
application program to implement this.
9.Create two packages p1 and p2.package p1 contains public class A which has one public method display().Package p2 contains one main class B. This class uses class A from package p1.Write a program to implement this.
BOOKS AND REFERENCES
1.Java: The Complete Reference Hebert Schildt, Mc Graw Hill