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

Java Object-Oriented Programming Guide

The document outlines various programming assignments focused on Object-Oriented Programming (OOP) concepts using Java, including the development of systems for school grading, healthcare scheduling, vehicle management, student registration, and conference registration. Each section emphasizes the importance of encapsulation, inheritance, abstraction, and exception handling in creating robust applications. The assignments encourage the implementation of validation mechanisms and custom exceptions to ensure data integrity and improve code maintainability.
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 views5 pages

Java Object-Oriented Programming Guide

The document outlines various programming assignments focused on Object-Oriented Programming (OOP) concepts using Java, including the development of systems for school grading, healthcare scheduling, vehicle management, student registration, and conference registration. Each section emphasizes the importance of encapsulation, inheritance, abstraction, and exception handling in creating robust applications. The assignments encourage the implementation of validation mechanisms and custom exceptions to ensure data integrity and improve code maintainability.
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

OBJECT ORIENTED PROGRAMMING THROUGH JAVA

II B. Tech I Sem (AY: 2025-26) Section-5


Computer Science and Engineering

Module Bank-1
1A) Discuss how a school grading system can manage students, subjects, and grade records using
Java and classify grades as pass, fail, or distinction.
B) Implement a GradeManager that validates grade entries by ensuring no duplicate grades are
recorded for the same student and subject. It should prevent invalid grade values such as negative
scores or grades beyond the allowed range before saving. Maintain consistent grade calculations
for each subject by verifying proper input and updating records correctly. Use exceptions like
InvalidGradeException and DuplicateGradeEntryException to improve accuracy and maintain
clean academic data. Show how this process ensures reliable and trustworthy grade records for all
students.
C) Develop a school grading management system in Java that manages students, subjects, and
grade records. Implement validation to avoid duplicate grade entries, throw exceptions for invalid
grades, and store all grades in a fixed-size array. After multiple entries, generate a performance
report listing each student with their subject-wise grades and overall result status.
2A) Describe how Java classes can be used to represent patients, doctors, and appointments in a
healthcare scheduling system and describe how encapsulation helps in securing sensitive patient
information. Also classify how different appointment states such as available, booked, and
canceled can be handled in the system.
B) Implement a Java application using classes and interfaces to manage patient and doctor details
for scheduling and canceling appointments. Apply exception handling to prevent double-booking
and invalid cancellations, ensuring that only valid appointments are confirmed. Use encapsulation
to restrict direct access to sensitive appointment data and maintain data integrity within the
application.
C) Develop a complete healthcare appointment scheduling system in Java that integrates patient
management, doctor availability tracking, and appointment conflict detection. Use a fixed-size
array to store appointments, use inheritance by creating a base Person class extended by Patient
and Doctor, and use an interface for sending booking notifications. Include exception handling for
time conflicts and missing records, ensuring proper reporting of appointment history.
3A) Discuss a Java class hierarchy for shapes using inheritance where Shape has color and filled
attributes, Circle adds radius with getArea() and getPerimeter(), and Rectangle adds width and
length with similar methods. Include constructors, method overriding, and creating objects to
display details.
B) Use a Java application that defines a Shape class with color and filled attributes, and extend it
with Circle and Rectangle classes. Write constructors to initialize the attributes, provide getters
and setters, and include getArea() and getPerimeter() methods in each subclass. In the main
method, create sample objects of Circle and Rectangle, initialize them with values, and print their
details along with the calculated area and perimeter to demonstrate inheritance and method
overriding.
C) Design a shape management system in Java that stores multiple shapes in an array of type Shape
and demonstrates runtime polymorphism. The system should allow adding different shapes such
as circles and rectangles, calculating their areas and perimeters, and printing all details in a
formatted report. Extend the system further by adding a new subclass Square that inherits from
Rectangle and shows how an inherited structure can be reused for specialized shapes. Finally,
iterate through the list of shapes to show how polymorphism ensures the correct getArea() and
getPerimeter() methods are invoked for each shape type dynamically.
4A) Classify how packages, abstract classes, and interfaces help in designing a modular Java
vehicle management system. Classify the purpose of placing the abstract class Vehicle in
[Link], concrete subclasses like Car and Motorcycle in [Link],
and the interface Convertible in [Link], and how this structure improves code
organization and maintainability.
B) Analyze how the Car and Motorcycle classes can override the start() and stop() methods from
the abstract Vehicle class while reusing the concrete accelerate(int speed) method. Demonstrate
how a Car class can also implement the Convertible interface to provide a specific
convertibleRoofStatus() implementation.
C) Design vehicle management system with the described package structure. Create the abstract
class Vehicle with abstract methods start() and stop(), and a concrete method accelerate(int speed).
Implement Car and Motorcycle classes in the [Link] package with appropriate
overrides. Define the Convertible interface in the [Link] package, and make the
Car class implement it. In a main class, create objects of Car and Motorcycle, demonstrate starting,
stopping, accelerating, and checking the convertible roof status.
5A) Discuss why input validation and custom exceptions are important in a student registration
system. Describe the role of a custom exception like InvalidAgeException and how it improves
readability and maintainability compared to using generic exceptions.
B) Illustrate how validation can be integrated into a student registration system to ensure correct
and meaningful data entry. Illustrate validating the age field so that it must be a positive integer
and at least 18 for eligibility. Illustrate how possible invalid inputs like negative numbers, non-
numeric values, or an age below the required threshold can be handled. Illustrate how Java’s try-
catch blocks can manage these errors gracefully without crashing the application, and how a
custom InvalidAgeException can be used specifically for age-related violations, making error
handling more structured and clear compared to generic exceptions.
C) Create a University Student Registration System in Java with strong input validation and proper
exception handling. Define a Student class with attributes like name, age, and registrationNumber,
and implement a custom checked exception InvalidAgeException for handling ages below 18. In
the main module, prompt the user for student details, validate that the age is a valid positive integer,
and handle invalid inputs such as empty strings, alphabetic characters, and unrealistic age values
using try-catch blocks. When validation is successful, register the student and display a
confirmation message with the student’s details. Allow the system to register a fixed number of
students using a simple array, and after registration is complete, display all valid student details
stored in the array.
6A) Classify how inheritance in Java helps reduce redundancy by defining common attributes such
as id and name in a base class Entity, and how subclasses like Product and Order can extend this
base class to inherit shared behavior while still adding their own specific attributes and methods.
B) Apply the concept of inheritance to design a system where Product and Order share common
properties from a base Entity class. Analyze how constructors in these subclasses can be structured
to initialize both the inherited id and name as well as their own additional attributes like price,
quantity, orderDate, and status. Modifying and accessing data in these objects illustrates the
benefits of a reusable class hierarchy compared to writing separate, duplicated classes for each
entity.
C) Design a Java class hierarchy that demonstrates code reuse through inheritance. Create a base
class Entity with id and name along with getters, setters, and a constructor. Extend it with a Product
class that includes price and quantity, and an Order class that includes orderDate and status, each
with methods specific to their functionality (e.g., calculating total stock value for Product or
updating order status for Order). In the main method, create several Product and Order objects,
initialize their attributes through constructors, update some values using setters, and display the
results to show how inheritance simplifies handling related entities.
7A) Discuss how abstraction and inheritance work together in a vehicle rental system to organize
shared attributes like make and year in an abstract Vehicle class. Show how subclasses such as
Car, Truck, and Motorcycle can extend this class, add their unique attributes, and override the
abstract method displayInfo() to provide specific details for each vehicle type.
B) Illustrate how inheritance improves code reuse and maintainability in a vehicle rental system
by allowing common data and behavior to be defined in an abstract Vehicle class. Illustrate how
overriding the displayInfo() method in Car, Truck, and Motorcycle enables polymorphic behavior
when accessed through a Vehicle reference. Illustrate how constructors should handle initializing
both the shared attributes (make, year) and subclass-specific attributes (numberOfDoors,
cargoCapacity, engineType), and how basic exception handling can prevent runtime errors in this
system.
C) Create a Java application for a vehicle rental system using inheritance and abstraction. Define
an abstract class Vehicle with attributes make and year and an abstract method displayInfo().
Extend it with subclasses Car, Truck, and Motorcycle, each adding specific attributes like
numberOfDoors, cargoCapacity, and engineType, and override displayInfo() to display full
details. Develop a main class that creates sample instances of each subclass, stores them in an array
of Vehicle, and demonstrates polymorphism by calling displayInfo() on each. Include proper
constructors, appropriate access modifiers, and basic exception handling to ensure smooth
execution.
8A) Classify how a Conference Registration System can manage events, sessions, and attendee
registrations using Java classes, and how these components work together to ensure session
capacity and attendee schedules are properly handled.
B) Illustrate how a RegistrationManager validates registration requests by parsing attendee input
strings with StringTokenizer to extract session IDs and attendee information, how it checks for
session availability, prevents duplicate registrations, and handles exceptions such as
SessionFullException and DuplicateRegistrationException to maintain accurate records and
smooth processing.
C) Develop a Conference Registration System in Java that integrates events, sessions, and attendee
registrations. Use StringTokenizer to parse registration inputs. Implement validation for session
availability and duplicate registrations, throw appropriate exceptions for invalid requests, and store
confirmed registrations in a fixed-size array. After multiple registrations, generate a session-wise
attendance report to help organizers track participant distribution effectively.
9) A university wants a text processing system to analyze sentences, manage game activities, and
maintain student records.
A) Describe how a given sentence can be separated into individual words using a text processing
system and classify the information such as total word count, longest word, and shortest word.
Also discuss how the system should represent these words in a meaningful way for easy
understanding.
B) Apply the concept of the Template Method design pattern to create an application that models
different types of games within the same framework. Use an abstract class to define the sequence
of game actions such as initialization, starting, and ending, while implementing subclasses like
Chess and Football to provide specific behaviors. Demonstrate how this system ensures code
reusability while allowing unique actions for each game type.
C) Create a university management system that maintains student records by creating a class with
attributes like a unique ID, name, and a list of projects. Extend the system with a separate class to
manage multiple students, allowing new student entries, project assignments, and retrieval of
information using the student ID. The application should ensure that each student’s ID remains
read-only after creation, provide methods to list all students with their assigned projects, and
maintain proper data integrity while updating the records.
10A) Classify how inheritance allows the Person superclass to define shared attributes like name
and age and a displayDetails() method that can be reused in subclasses, and how Student and
Faculty subclasses can extend this behavior by including additional details such as GPA, enrolled
courses, department, and courses taught.
B) Implement the concept of method overriding in a university system where Student and Faculty
subclasses override displayDetails() from the Person superclass. Use the super keyword to call the
superclass method before adding subclass-specific information, and demonstrate dynamic method
dispatch by invoking displayDetails() on different object types.
C) Develop a Java application for a university system with a Person superclass containing common
attributes and a displayDetails() method. Extend it with Student and Faculty subclasses that add
their own unique attributes and override displayDetails() while calling [Link]() to
include basic details. Use polymorphism by creating Person, Student, and Faculty objects,
invoking displayDetails() on each to show how dynamic method dispatch works.

You might also like