OOPS ASSIGNMENT
NAME: Gelivi Bharath
REG NO:23BCE8518
SLOT NO: L27+L28+L39+L40
COURSE CODE:CSE2005
COURSE TITLE:OBJECT ORIENTED
PROGRAMMING IN JAVA WITH LAB
FACULTY NAME:SANTHADEVI D
INDEX
[Link] ASSIGNMENT QUESTIO TOPIC -page number
N
1. ASSIGNMENT-1 Q1 Integer Input Check (Positive, Negative, Zero,
Even, Odd, Multiple of
pg-4,7
2. Assignment-1 Q2 Electricity Bill Calculation pg-
7,8
3. Assignment-1 Q3 Prime Numbers between 1 and 100 pg-8,9
4. Assignment-1 Q4 Password Checker with Limited Attempts pg-
9,10
5. Assignment-1 Q5 BankAccount Class with Encapsulation pg-
10,13
6. Assignment 2 Q1 Palindrome Checker (Ignore Case and Non-
Alphanumeric)
pg-14,15
7. Assignment 2 Q2 Word Frequency Counter pg-15,16
8. Assignment 2 Q3 Mask Sensitive Information (Credit Card) pg-
16,17
9. Assignment 2 Q4 Custom String Formatter (Report Card) pg-
17,18
10. Assignment 2 Q5 Capitalize Each Word in a Sentence pg-
19
11. Assignment 2 Q6 Anagram Checker
pg-20,21
12 Assignment 2 Q7 Reverse Words in a String
pg-22,23
13 Assignment 2 Q8 Array statistics Calculator
pg-24,25
14 Assignment 2 Q9 Password Validator
pg-26,27
15 Assignment 2 Q10 Student Marks Report
pg-27
16. ASSIGNMENT 3 Q1 Single Inheritance (Employee and Manager)
pg-28
17. ASSIGNMENT 3 Q2 Multilevel Inheritance (Vehicle, FourWheeler,
Car) pg-29,30
18. ASSIGNMENT 3 Q3 Hierarchical Inheritance (Person, Student,
Teacher) pg-31,32
19. ASSIGNMENT 3 Q4 Method Overloading (Bill Calculator)
pg-33
20. ASSIGNMENT-4 Q1 Interface (Shape: Rectangle, Circle, Triangle)
pg-34
21. ASSIGNMENT-4 Q2 Employee Payroll Calculation
pg-35,36
22. ASSIGNMENT-4 Q3 Anonymous Inner Class (Greet)
pg-36
23. ASSIGNMENT-4 Q4 Non-static Inner Class and Anonymous Inner
Class (Library, Book, Log
pg-36,37
24. ASSIGNMENT-5 Q1 Exception Handling (ArithmeticException, pg-38
ArrayIndexOutOfBoundsEx
InputMismatchException)
25. ASSIGNMENT-5 Q2 Exception Handling
(StringIndexOutOfBoundsException, NullPointerE
pg-39
26. ASSIGNMENT-5 Q3 Custom Exceptions (EmptyPasswordException,
WeakPasswordExcep
pg-40
27. ASSIGNMENT-5 Q4 Custom Exceptions (ItemNotFoundException,
OutOfStockException)
pg-40,41
28. ASSIGNMENT 6 Q1 ArrayList (Employee Management)
pg-42,43
29. ASSIGNMENT 6 Q2 HashSet (Library Management - Set Operations)
pg-43
30. ASSIGNMENT 6 Q3 HashMap (Employee Management)
pg-44,45
31. ASSIGNMENT 6 Q4 Multithreading (Fitness Tracker - Step Counter,
Heart Rate Monitor)
pg-46,47
32. ASSIGNMENT 6 Q5 Thread Synchronization (Banking Application)
pg-47,48
33. ASSIGNMENT 6 Q6 Multithreading (Traffic Control System)
pg-49,50
Assignment java lab1
Program 1
Q1. Write a Java program that takes an integer input from the user and
checks whether the number is:
Positive, negative, or zero
Even or odd
A multiple of 5Use if-else and switch-case statements where appropriate.
Display all the results clearly.
This program to check positive or negative or zero
Output-
Even odd checker
Output-
Multiple of 5 checker
Output-
Program2-
write a java program to caluclate the electricity bill on units consumed
first 100 units-2 rupee per unit
next 200 units -3 rupee per unit beyong 300 is 5 rupee per unit
add a surcharge of 10% on the total bill if it exceeds 1000 rupee
Output-
Program 3-
write a java program to print all prime numbers between 1 -100 using a
for loop ,use continue statement to skip non – prime
Output-
Program4-
Password checker with lmited attempts (while ,break) write a java
program that asks for user input and user gets only 3 attempts if correct
password is entered print access granted or else print access denied
Output-
Program5-
3 and 5th question are same so doing 6th question
Create a java class called bank account that uses encapsulation to
manage private fields such as account number(string) ,account holders
name(string),balance(double)
Implimenting the following –
Getters and setters for each field but prevent setting a negative balance
(display a warning if attempted a method deposit that deposits
ammount(double),a method withdraw (double) checks if balance is
enough if yes then deduct the ammount else show insuffiecent funds
then in main method
Create a bankaccount object
Set account details using setters
Call deposit() and withdraw() and print the final balance
Output-
Assignment Java lab 2
program1-1Q. Palindrome Checker (Ignore Case and Non-Alphanumeric
Characters INPUT:
Output-
program2-word frequency counter
Output-
program3-sensitive info masking
Output-
program4-custom string formatter
Output-
program5-capatalize each word in a sentance
Output-
program6-anagram checker
Output-
program7-reverse words in a sentance
Output-
program8-array statistics clauclator
Output-
program9-password checker
Output-
program10-students marks report
Output-
lab3
program1-single inheritence with constructor
Output-
program2-multilevel inheritence with constructor
Output-
program3-heirarchial inheritence
Output-
program4- Method Overloading (Bill Calculator)
Java Asignment-4
Program1-
Output0-
Program2-the [Link] is package and [Link] is the file where it
executes it
Output-
Program3-Anonymus inner class
Output-
Program4- Non-static Inner Class and Anonymous Inner Class (Library,
Book, Log
Output-
Java Assignment 5
Program1-
Output-
Program2-
Output-
Program3-
Output-
Program4-
Output-
Java Assignment 6
Program1-Array list Emp management
Ouput-
Program2-Hash set Library management
Output-
Program3-Hash map employee management
Ouput-
Program4-Multi threading fitness tracker
Ouput-
Program5-Thread synchronization (banking application)
Output-
Program6-Multi threading (traffic control system)
Ouput-