Java Group Assignment (2)
Java Group Assignment (2)
LG- 1
1. What is the role of constructors in Java? How do they differ from methods?
2. Explain access specifiers in Java with examples for each type.
3. Write a Java program to create an integer array, initialize it with user input, and calculate the sum of its
elements.
4. Demonstrate the concept of inner classes in Java with an example involving a class `Outer` and an inner class
accessing its variables and methods.
5. Write a Java program to create an integer array, initialize it with user input, and compute the sum of all
elements.
LG-2
1. Write a Java program to create a `Movie` class with attributes `title`, `director`, and `release year`. Use an array
of `Movie` objects and include methods to display details and search for a movie by title or director.
2. Develop a Java program to create a `Travel` class with attributes `destination`, `distance`, and `mode of
transport`. Include an array of `Travel` objects and methods to display trip details and calculate the total distance.
3. Create a `WeatherForecast` class with attributes `city`, `temperature`, and `weather condition`. Include
methods to display city details and search by name.
4. Explain garbage collection in Java, including its purpose and working.
5. Discuss the difference between `==` and `.equals()` in Java, with examples.
LG-3
1. Design a system to manage food orders using the following classes:
- `Restaurant` (attributes: `name`, `menu`, `location`)
- `FoodItem` (attributes: `id`, `name`, `price`, `availability`)
- `Order` (attributes: `id`, `restaurant`, `items`, `total`)
Include methods to place orders, calculate bills, and update food availability.
2. Create a `ShoppingCart` class with fields for items and prices, along with methods to add items, calculate the
total, and display cart details.
3. Implement a `Doctor` class with fields `id`, `name`, `specialization`, and a `patientsList` (list of `Patient`
objects).
4. Describe Java's naming conventions for classes, methods, variables, and constants.
5. Differentiate between `public`, `private`, and `protected` member functions in Java.
LG-4
1. Write a Java program to create a `Student` class with attributes `name`, `rollNumber`, and `marks`.
2. Implement a `BankAccount` class with attributes `accountNumber`, `accountHolderName`, and `balance`.
Create and display an object of the class.
3. Create a `Store` class with attributes `productName`, `price`, and `quantity`. Use an array of `Store` objects and
display each product's details.
4. Explain the difference between a class and an object in Java with examples.
5. Describe the purpose and types of constructors in Java, with examples.
LG-5
1. Discuss Java's garbage collection mechanism, its advantages, and how unused objects are identified and
removed.
2. Differentiate between method overloading and overriding in Java, with examples.
3. Write a Java program to create a `Book` class with attributes `title`, `author`, and `price`. Use an array of
`Book` objects and include methods to display details and search for books within a price range.
4. Develop a `Student` class with attributes `name`, `rollNumber`, and `marks`. Use an array of `Student` objects
to display details and calculate average marks.
5. Write a program to create an `Employee` class with attributes `name`, `ID`, and `salary`. Use an `ArrayList` to
store objects and include a method to grant a 10% bonus to employees earning below a specified amount.
LG-6
1. What are Java Buzzwords? Explain five of them. Discuss the differences between constructors and methods,
with an example.
2. Elaborate on inheritance in Java, and explain how `super` and `this` keywords are used in inheritance.
3. Write a Java program to calculate the sum of all even numbers in an array.
4. Demonstrate single inheritance in Java with a parent class calculating the area of a rectangle and a child class
calculating the area of a square using method overriding.
LG-7
1. Explain the principles of Object-Oriented Programming (OOP) in Java.
2. Describe inheritance in Java.
3. Create a Library Management System simulation using classes and objects.
4. Implement a program that demonstrates inheritance using a `Vehicle` class hierarchy.
5. Design a program for a Student Grading System.
LG-8
1. What are JDK, JRE, and JVM in Java? Explain their roles.
2. What are control statements in Java? Classify them and provide examples.
3. Write a Java program demonstrating method overloading.
4. Explain encapsulation with an example related to securing account balance.
5. Discuss constructors in the context of a student record system.