0% found this document useful (0 votes)
2 views1 page

Basic Java Experiments

The document outlines three programming tasks: creating a BankAccount class with methods for deposit and withdrawal, implementing an Employee hierarchy with a Manager subclass that includes a bonus, and defining a Payment interface with implementations for CreditCard and UPI payments. Each task includes specific requirements for data members, methods, and main program functionality. The overall focus is on object-oriented programming concepts such as classes, inheritance, and interfaces.

Uploaded by

yaminig122500
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 views1 page

Basic Java Experiments

The document outlines three programming tasks: creating a BankAccount class with methods for deposit and withdrawal, implementing an Employee hierarchy with a Manager subclass that includes a bonus, and defining a Payment interface with implementations for CreditCard and UPI payments. Each task includes specific requirements for data members, methods, and main program functionality. The overall focus is on object-oriented programming concepts such as classes, inheritance, and interfaces.

Uploaded by

yaminig122500
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/ 1

Program 1: Bank Account Management

Problem Statement:
Create a class BankAccount with the following:

 Data members: accountNumber, accountHolderName, balance

 Getter and Setter methods

 Methods: deposit(), withdraw()

 Add toString()

Write a main program to:

 Create two account objects and assign values to data members using setters

 Perform deposit and withdrawal operations.

 Display account details after each operation using getters.

Program 2: Inheritance - Employee Hierarchy

Problem Statement:
Create a base class Employee with:

 empId, name, basicSalary

 Method: displayDetails()

Create a derived class Manager:

 Additional field: bonus

 Override the displayDetails() method to include bonus and calculate total salary.

In the main method:

 Create objects of both Employee and Manager and display their details.

Program 3 : Interface Implementation – Payment Gateway System

Problem Statement:
Define an interface Payment with a method processPayment(double amount).

Implement the interface in two classes:

 CreditCardPayment (prints: "Paid [amount] using Credit Card.")

 UPIPayment (prints: "Paid [amount] using UPI.")

In the main program:

 Accept user input to choose payment method and amount.

 Call processPayment() using the interface reference.

You might also like