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

Lab Exercise4

The document outlines a lab exercise focused on abstract classes and interfaces in Java. It includes tasks for creating abstract classes for Student and BankAccount, along with their concrete implementations, and also requires the implementation of a Moveable interface with classes like Airplane, Car, and Boat. Additionally, it emphasizes the design of a WarehouseManagement interface and an InventoryManager class that can accommodate new product types without modifying existing code.

Uploaded by

hithere1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Lab Exercise4

The document outlines a lab exercise focused on abstract classes and interfaces in Java. It includes tasks for creating abstract classes for Student and BankAccount, along with their concrete implementations, and also requires the implementation of a Moveable interface with classes like Airplane, Car, and Boat. Additionally, it emphasizes the design of a WarehouseManagement interface and an InventoryManager class that can accommodate new product types without modifying existing code.

Uploaded by

hithere1234
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab Exercise 4

Part 1: Abstract Classes


1. Create an abstract class Student with instance variables name, averageTestScore and
academicStatus, with an abstract method determineAcademicStatus(). a. Create
concrete classes UnderGraduate and PostGraduate, which inherit from Student
and implement determineAcademicStatus().

2. Create an abstract class BankAccount with instance variables accountNumber,


interestRate, and balance; The class also has methods deposit(), withdraw() and
calculateInterest().
a. Implement concrete classes SavingsAccount and CheckingAccount, which inherit
from BankAccount. Demonstrate these classes with sample deposit and withdrawal
operations. Assume any relevant assumptions to abide with real world transactional
scenarios. (Note: that withdrawal is allowed for saving account if it does not exceed
the balance; for checking account it is possible to withdraw an amount that is more
than the balance provided the overdraft limit is not exceeded.)
Part 2: Interfaces
1. Write a java program with interface named Moveable that has a method moveObject().
Create three concrete classes namely, Airplane, Car, and Boat to implement the
Moveable interface.

2. Write a java program to implement an interface namely, WarehouseMmanagement with


methods getName(), getUnitPrice(), and getQuantity().
a. Implement the interface with classes ElectronicProduct,
ClothingProduct, and FoodProduct
b. Create an InventoryManager concrete class responsible for managing a
warehouse inventory. It should have methods for adding products, removing
products and calculating grandTotal (value).

Make sure that that the program can easily accommodate new types of products in the
future without modifying existing code. For example, you should be able to add a
FurnitureProduct class without changing the InventoryManager class.

Make sure that the InventoryManager class depends on an interface rather than
concrete implementations.

You might also like