0% found this document useful (0 votes)
4 views

Problemset-1

Uploaded by

mckvie25
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Problemset-1

Uploaded by

mckvie25
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Write a Java program to create an abstract class BankAccount with abstract


methods
deposit() and withdraw(). Create subclasses: SavingsAccount and CurrentAccount
that extend the BankAccount class and implement the respective methods to handle

deposits and withdrawals for each account type.also overrides the withdraw()
method to
prevent withdrawals if the account balance falls below one hundred.

2. Write a Java program to create a vehicle class hierarchy. The base class should
be Vehicle,
with subclasses Truck, Car and Motorcycle. Each subclass should have properties
such as make,
model, year, and fuel type. Implement methods for calculating fuel efficiency,
distance traveled, and maximum speed.

3. Write a Java program to implement a stack that checks if a given element is


present or not
in the stack.

You might also like