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

Task For Core Java - Pradip K

The document provides tasks related to Java programming concepts like classes, objects, constructors, encapsulation, inheritance, abstraction, interfaces, collections, multithreading and databases. It includes tasks to create classes for Employee, Student, Product etc and perform operations like accepting and displaying details, calculating totals and percentages. It also includes tasks on inheritance, method overriding, abstract classes and interfaces. Collection tasks involve using List, Stack, LinkedHashSet etc. Multithreading tasks require implementing Runnable interface and using join(). Database task involves creating an Employee table.
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)
28 views

Task For Core Java - Pradip K

The document provides tasks related to Java programming concepts like classes, objects, constructors, encapsulation, inheritance, abstraction, interfaces, collections, multithreading and databases. It includes tasks to create classes for Employee, Student, Product etc and perform operations like accepting and displaying details, calculating totals and percentages. It also includes tasks on inheritance, method overriding, abstract classes and interfaces. Collection tasks involve using List, Stack, LinkedHashSet etc. Multithreading tasks require implementing Runnable interface and using join(). Database task involves creating an Employee table.
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/ 8

Task for Core Java – Pradip K.

** Class and Object Task **

-------------------------------------------------------

Task # 1:-

1. Create a class Employee class [id, name, age, salary]

A] accept a Employee details [accept() method]

B] display all Employee Details [display() method]

Task # 2:-

create a class Student class [id, name, per]

A] accept 3 Student details [accept() method]

B] display all Student Details

C] display only those Student per is more that 75%

Task # 3:-

create a class Student class [id, name, per]

A] accept 1 Student details as id,name, marks1,marks2,marks3,[accept() method]

B] calculate total marks and per ;

C] display Student Details only id,name,& per

--------------------------------------------------------------------------------------------------------------

W.A.java program create a class Student details which having roll_no, name, percentage. Accept a
student records and display it [use accept_data() and display_data() methods..].

W.A.java program create a class Employee [ emp_id, emp_name, age, salary]. Accept a Employee
records and display it [use accept_data() and display_data() methods..].

W.A.java program create a class Student details which having roll_no, name, percentage. Accept 3
students records and display it.(use Constructor).
W.A.java program create a class Mobile [model_no, model_name, cost] Accept 5 Mobiles details
and display it.(use Constructor and array of Objects).

W.A.java program create a class Student details which having roll_no, name, and 5 subjects marks[ ].
Accept a students records, find total_marks and percentage. display the all student data.

Write a java program for a cricket_player The program should accept the details from user [ Player
code, name,country_name, runs,]. The program should contain following:

-Enter details of 10 players.

-Display average runs of a single player.

============================================================================

** Section 02:- Class- Object - Constructor Task **

-----------------------------------------------------

Task # 1:-

Create a class Employee class [id, name, age, salary]

A] Accept a Employee details [Constructor]

B] Display all Employee Details

Task # 2:-

create a class Student class [id, name, per]

A] accept 3 Student details [Constructor]

B] display all Student Details

C] display only those Student per is more that 75%

Task # 3:-

create a class Student class [id, name, per]

A] accept 1 Student details as id,name, marks1,marks2,marks3,[Constructor]

B] calculate total marks and per ;

C] display Student Details only id,name,& per


Task # 4:-

create a class Product class [id, name, qty ,cost ]

A] accept 3 Product details [Constructor]

B] display all Product Details

C] Create Bill class [total_bill]

D] send all 3 Product details to Bill class

E] calculate total_bill

D] send total_bill to main class and print it.

============================================================================

**Encapsulation**

1. create a class Student class [id, name, per]

A] accept a Student details [Constructor]

B] display all Student Details

C] if per is updated , should be in between 0 to 100 %

----------------------------------------------------------------------------

2. create a class Employee class [id, name, age, salary]

A] accept a Employee details [Constructor]

B] display all Employee Details

C] if age will be updated , should be greater than 18+.

D] if salary will be updated , should be greater than Zero.

============================================================================
** Inheritance - Method Overriding **

create a class Account [acc-no, name, balance] which having deposite() and withdraw() method

create two child classes as SavingAccount [min_balance=1000] and


CurrentAccount[min_balance=5000] from Account class

> override Account class methods into child classes

> if withdraw() operation performs then min_balalance should be maintaied

> print the 2 details of Saving Account holder and Current Account holder .

----------------------------------------------------------------------------

[ ] ------- Inheritence -----

----------------------------------------------------------------------------------------------------

In a bank, different customers having saving account.

Some customers may have taken a loan from the bank.

So bank always maintains information about bank depositors and borrowers.

Design a Base class Customer (name, phone-number).

Derive a class Depositor (accno , balance) from Customer.

Again derive a class Borrower (loan-no, loan-amt) from Depositor.

Write necessary member functions to read and display the details of ‘n’ customers.

----------------------------------------------------------------------------

Define an Employee class with suitable attributes having getSalary() method,

which returns salary withdrawn by a particular employee.

Write a class Manager which extends a class Employee,

override the getSalary() method, which will return salary of manager

by adding Different HRA and DA.

----------------------------------------------------------------------------

Define an Phone class (modelNo,model_name,cost),

create 3 subclasses from Phone as Smartphone , Mobile and Landline .

use extra details in subclasses and methods, which will insert and display a

records of all.
A] insert 5 Employee records

B] display all 5 Employee records

----------------------------------------------------------------------------

Define an Furniture class (Type, cost), create 3 subclasses from Furniture as Chair ,

Table and Sofa. use extra details in subclasses and methods, which will return a records of Chair ,

Table and Sofa.

===============================================================================

[ ] ------- abstraction-----

----------------------------------------------------------------------------------------------------

Define an abstract class Person having (id, name,age)with having getSalary() abstract method

create Employee class from Person with(salary) having getSalary() method

. Write a class Manager which extends from Person the getSalary() method,

dispaly the salary of Employee and manager by adding Different HRA and DA.

Create a interface Shape which consists abstract method area () and volume ().

Create three subclasses Rectangle, Circle and Triangle and calculate area and volume of it.

Define an abstract class Phone class (modelNo,model_name,cost) and abstract method as doCall(),

doCharge(), create 3 subclasses from Phone as Smartphone, Mobile and Landline .

use extra details in subclasses and methods, which will return a records of Smartphone , Mobile and
Landline.

Write a abstract class Manager, having attributes and abstract and non-abstract methods,

create Employee class from Manager with suitable attributes and method,

which returns salary withdrawn by a particular employee, daily report, task submisstion .

==================================================================================
-----Interface-------

We have all come across ATMs in our cities and it is built on Java.

This complex project consists of five different classes and is a console-based application.

When the system starts the user is prompted with user id and user pin.

On entering the details successfully, then ATM functionalities are unlocked.

The project allows to perform following operations:

Transactions History

Withdraw

Deposit

Transfer

Quit

===============================================================================
** Collection **

------------------------------------------

#1

create a class Product class [id, name, qty ,cost ]

A] accept 3 Product details [List]

B] display all Product Details

C] display those Product cost is more that 100 rs

D] display those Product qty is more that 5

---------------------------------------------------------------------

#2 create a class Employee [emp_id,name,role,salary]

A] insert 5 Employee records [List]

B] display all 5 Employee records

C] print only those having role is "Tester"

D] print only those having role is "Developer"

E] print only those having role is "Developer" and salary is above 20000

F] update all Employee salary

- if sal <10000 --> update 10%

- if sal >10000 && <20000 --> update 15%

- if sal >20000 --> update 20%

---------------------------------------------------------------------------------------------------------------

Q.Write a java program to read n Students names from user, store them into the ArrayList collection.
Display the names in Ascending order.

Q.Write a java program to read n String names from user, store them into the ArrayList collection.
And iterate it .

Q. Program to add, retrieve & remove element from ArrayList.

Q. Program to Implement push() and pop() on Stack.

Q. Program to Sort & reverse the LinkedList elements.

Q. program to delete duplicate user defined object from the LinkedHashSet

Q. Copy all elements from HashSet to Array


[ ]------- Multithreading-----

----------------------------------------------------------------------------------------------------------

Q Write a program which perform two task at a time for addition of two nos and subtraction of two
nos using multithreading program

Q Write a thread program for implementation of Runnable interface

Write a program which perform two task at a time for sum of 1 to 10 nos and sum of 1 to 10 nos

using multithreading program

Write a program which perform two task at concurrently using join() in multithreading

Write a thread program for print the current thread name by set them manually.

---------------------------------------------------------------------------------------------------

** Database Task #1

table :- Employee [emp_id,name,role,salary]

A] insert 5 Employee records

B] display all 5 Employee records

C] update all Employee salary

- if sal <10000 --> update 10%

- if sal >10000 && <20000 --> update 15%

- if sal >20000 --> update 20%

D] delete those records emp_id range between 10-15.

E] print only those having role is "Tester"

F] print only those having role is "Developer" and salary is above 20000

You might also like