Java Programming Syllabus Assignment LabPractice
Java Programming Syllabus Assignment LabPractice
Java Programming Syllabus Assignment LabPractice
in
+91 88230 75444
401, Shekhar Central, Palasia Square, Indore, MP - 452001 +91 99939 28766
Java Programming
*1. Write a program to accepts a number from user and check given number is even or odd.
*2. Write a program to accepts two numbers from user and calculates first no is divisible by
second or not.
*3. Write a program to accepts three numbers from user and calculate biggest number out of
three numbers.
*5. Write a program to input basic salary of an employee and calculate its Gross salary
according to following rules:
*6. Write a program to show day of week according to user input by using switch case.
*7. Write a program to perform all arithmetic operations according to user choice (for ex-for
addition press ‘+’...) by using switch case.
*8. Write a program to find maximum between two numbers.
*9. Write a program to find maximum between three numbers using if-else and ternary
operator.
*10.Write a program to calculate sum of digits of a number of three digit number using if-
else
*11. Write a "Bonus Distribution Program" using logical operators. Bonus will be given to
all those employees who have salary less than 20000 and tenure is more than 3 years.
*12 Write a code (using nested switch case) to suggest a diet plan (calories) to
a consumer on behalf of inputs(gender and food time).
#1. Write a program that accepts the age of person, find out the person is eligible for voting
or not.
#2. Write a program that accepts a number from user and find whether it is positive or
negative or zero.
#3. Write a program to calculate whether year is leap year or not.
#4. Write a program that accepts five subjects ’marks from user and calculate the total marks
then calculate Percentage. Display message according to following condition:
*1. Write a program to print “Code Better” five times by using loop.
*2. Write a program to print n natural number.
*3. Take any ten numbers from user and print sum and average of these numbers.
*4. Take any ten numbers from user and print sum and average of positive numbers.
*5. Take the numbers from user (until ten +ve numbers entered by the user), and print sum
and average of these numbers.
*6. Write a program to calculate factorial of a given number.
*7.Write a program to calculate sum of digits of a number.
*8. Write a program to find out reverse of a given number.
*9. Write a program that accepts a number from user and check given number is Armstrong
number or not.
*10. Write a program to find LCM of two numbers.
.e.g. LCM of 4 and 6 is 12
*11. Write a program to find HCF of two numbers.
.e.g. HCF of 16 and 24 is 8
*12. Write a program that accepts a number from user and check given number is prime
number or not.
*13. Print Fibonacci series unto n terms 0,1,1,2,3,5,8,……
* * * * * * 12345
** * * * * 12345
*** * * * 12345
* * 12345
*****
* 12345
*******
1 ** * *
1 1 ***** **** ** **
1 2 1 * * ****** *** ***
1 3 3 1 * * ******** **** ****
1 4 6 4 1 * * ********** **********
***** ********** **********
******** **** ****
****** *** ***
**** ** **
** * *
Section 4 - Functions
Function Types, Parameters, Declaration
Call by value & Call by reference
Scope, Visibility & Lifetime of Variable
Recursion
#1. Write a program to check the prime number using function with argument and no return
type.
#2. Write a program to print all even or odd numbers in given range using recursion.
#4. Write a program to print all natural numbers between 1 to n using recursion.
Section 5 – Array
- - Array Concept, Declaration and Initialization, length
- One Dimension Arrays
- Two Dimention Arrays
- Zagged- Array
#1. Write a program to count total number of even and odd elements in an array.
#2. Write a program to copy all elements from an array to another array.
#7. Write a program to check whether two matrices are equal or not.
#10 Write a program to print words representation of entered number. e.g. if entered number
is 245983 then result should be Two Lac Forty Five Thousand Nine Hundred Eighty Three
#11. Ask user to enter any four numbers between 1 to 9 and print all numbers made using
combination of these four number. Do not repeat any digit in the same number.
#12. Find 2nd highest number from and 2nd minimum from array of n elements.
#13. Create a function that accept two Int arrays and return sum of all elements of both arrays
Section 6 - Object Oriented Programming
- Object oriented programming concepts- Object, Classes
- Polymorphism –static and dynamic
- Java-Class declaration, Compilation, Loading, Execution
- Java-Object References, Object allocation and Heap
- Instance Variable, Class Variable
- Instance Method, Class Method
-Constuctor-Default and Parameterised
- this keyword
- Static block,default initialization block
- Polymorphism and method overloading
- Methods with objects as arguments
- Has-A relationship
- Array of Objects, For Each Loop
- Method with Array as argument
- Variable Argument Methods
- Inner Class- static,member,local
- Class , object, reference, methods
- constructor , this keyword
- Static variable
- Array of objects, HAS-A relation
— GC and memory management
#1. Create a class Rectangle with three data member (length, breadth & area).
Now also create method members
• inputValue() - to take input for length and breadth from user.
• calculateArea() - to calculate area of rectangle.
• showArea() - to display the area of rectangle.
#2. Create a class DemoArithmetic with three data member that are firstNo, secondNo and result .
In this class also create following method:
a. inputValue() - to take input value from user for firstNo and secondNo
b. addition() - to perform addition operation and store in result var
c. substraction() - to perform substraction operation and store in result var
d. multiplication() - to perform multiplication operation and store in result var
e. divide() - to perform divide operation and store in result var
f. show() - display value of result variable.
#3. Create a class Student with data member(stuName, stuId, stuPercentage) to store the
information of student And also create following method:
a. inputStuInformation() - to take infromation about student from user
b. outputStuInformation() - to display information of student
#4. Create a class Addition with member function addition() with following given argument
a. three float
b array of integer
c two integer
#5. Create a class Student with data member (stuId ,stuName ,stuPer) ) by using following
properties:
a. Only parameterized constructor;
b. ShowStuInformation() method - display the information of student.
c. Create three student object and call ShowStuInformation method
#9. Create class BankAccount with data members accountNo, name, balance.
- Create display() method.
- Create another method deposit(amount:Float) which add amount value to balance
- Create withdraw(amount:Float) method which subtract amount from balance.
- Store 5 BankAccount Information in an Array and display all records. Ask user to select
#2. Create class Employee(id, name, salary) and add display function
- create class PartTimeEmployee with variable(hoursWorked , hourlyRate) and inherit -
class Employee. Add calculateSalary() function to calculate salary as salary = hourlyRate *
hoursWorked
- create class FullTimeEmployee with variables(basic, da, pf) and Add calculateSalary()
function to calculate salary as salary = basic + da - pf
- add default and parameterized constructor in all classes
- Create a global function getTax(emp:Employee) which accept Employee object in
argument and calculate and print income tax on employee salary(12.5% of salary)
- Also try to pass Objects of PartTimeEmployee and FullTimeEmployee to getTax() method
#4. Create a class Bird with properties – name, habitat, food, feather color. Create Abstract Class
FlyingStyle, which has a method fly (). Inherit this class to Bird class and write code for the fly
method.
#5. Create interface Taxable with variables taxRate{get}, and function getTax()->Float
- create class Employee(id,name,salary) add display function. Implement Taxable interface. Decide
income taxRate 30% for salary above 10 lac, 20% for salary between 5 and 10 lac and 6% for salary
below 5 lac
- create class Restaurent (restaurent name, Bill amount). add display and input function. decide GST
10% and implement Taxable protocol to getTax()
- create 2 object of Employee and 3 Obj of RestaurentBill and print total amount of tax on all 5
objects
- Create Global function that accept reference of type Taxable and print 5% of refund on tax
applied.
#6
- Create an Abstract class Processor with int member variable data and method showData to
display data value. Create abstract method process() to define processing of member data.
- Create a class Factorial using abstract class Processor to calculate and print factorial of a
number by overriding the process method.
- Create a class Circle using abstract class Processor to calculate and print area of a circle
by overriding the process method
Ask user to enter choice (factorial or circle area). Also ask data to work upon; Use Processor class
reference to achieve this mechanism
#7 Explain the importance of toString() and equals() method of the Object class and override them
on class Employee(empId,name,salary).
- Create class for main method(say XYZ),and accept five employees information and store
in an array. Also ensure if entered empId already exist or not (use equals method).
- Display all employee info using toString method;
#1 Create a following class/package structure in your application. Filled squares are packages and
empty circles are classes.
▪ campus.data
o Person (name, age, address)
▪ campus.academics
o Student(rollno, branch, semester) inherits Person
o Faculty(facultyId, name, salary, branch) inherits Person
▪ campus
o CampusApp- this class contains main method to accept 5 Faculty
information and print total of salaries of all faculties.
Take your assumptions regarding subject, branch and student data. Create this application
as a runnable jar file.
#1 Store name of weekdays in an array (starting from “Sunday” at 0 index). Ask day position from
user and print day name. Handle array index out of bound exception and give proper message if
user enter day index outside range (0-6).
#2 Create a class Voter(voterId, name, age) with parameterized constructor. The parameterized
constructor should throw a checked exception if age is less than 18. The message of exception is
“invalid age for voter ”
2. Create a class that checks whether a given number is prime or not using Runnable
interface
Section 12 - Java IO
- Java IO – Concept of streams
- Input Streams – text and binary, standard input
- Output Stream – text and binary, standard output
- Text File Reading Writing
- Binary File Reading Writing
- DataInputStream/DataOutputStream
- ObjectInputStream/ObjectOutputStream
- Searialization and Other Streams
4. Write a program to count how many times character ‘t’ occurs in a file.
5. Write a program to count no of words in a text file and average word size.
6. Write a program to count number of bytes in a image file(jpeg/png/gif). Also find how
much time it will take to upload the file on server if internet speed is 256 bps(bits per
second).
7. Write a program to store your shopping details in a binary file(shopping.dat) with
information itemName, price, quantity. (Use ObjectOutputStream to store Item class object
).
8. Write a program to read data from shopping.dat file creted in above problem and find total
money spent on all shopping items. . (Use ObjectInputStream to read Item class object ).
Section 13 – Generics
- Concept of Generics
- Generic Types
- Generic Methods
- Bounded Type Parameters
- Generic Type Inheritance and Subtypes
- Wild cards
Section 14 - Strings
- Declaring Strings in
- Strings Input and Output functions
- String Comparison
- String Functions
#1. Write a program to convert string into lowercase without any library function.
#3. Write a program to count total number of vowels and consonants in a string.
*1. Create a map to store student rollno (key) and name(value). store 5 pairs by default
*2. Create a map to store name_of_course (key) and duration_in_month(value). store 5 pairs
by default
*3. Declare Class to store information about Book Title, Price, Auther, pageCount. Store
information of any 4 books in an ArrayList and print as below
————————————————
…………………………………
*4. Create a Map to store name of cricket teams according to their world rankings
*5. Create a set of different movie star names. Perform these operations on the set
#2. Create a Map to store name_of_course (key) and duration_in_month(value). store 5 pairs
by default
#3. Create Map to store name of states and 3 cities of each state
#5. Create a set of 10 numbers and perform these operations on the set
2. Create BankAccount Management App to store , delete, update, list, deposit, withdraw,
search records of Bank Account. Store accNo, customer name, balance, account type
3. Create CodeBetter enquiry system to store, delete, update, list, search enquiry details.
Store enquiry details like candidate name, contact, address, course selected, course fee