The document contains 4 practice problems on object-oriented programming concepts like abstraction, interfaces, and inheritance:
1. Defines an abstract Arithmetic class with abstract subtraction methods and implements them in ArithmeticImpl.
2. Defines a Shape interface with draw and rotate methods. Circle and Rectangle classes implement Shape.
3. Defines a GeometryConstant interface and GeometryMethod interface. A Circle class implements both and defines area and circumference methods.
4. Defines an AccountInter interface with create, delete, and print methods. An Account class implements the interface and an AccountDemo class demonstrates its use.
The document contains 4 practice problems on object-oriented programming concepts like abstraction, interfaces, and inheritance:
1. Defines an abstract Arithmetic class with abstract subtraction methods and implements them in ArithmeticImpl.
2. Defines a Shape interface with draw and rotate methods. Circle and Rectangle classes implement Shape.
3. Defines a GeometryConstant interface and GeometryMethod interface. A Circle class implements both and defines area and circumference methods.
4. Defines an AccountInter interface with create, delete, and print methods. An Account class implements the interface and an AccountDemo class demonstrates its use.
The document contains 4 practice problems on object-oriented programming concepts like abstraction, interfaces, and inheritance:
1. Defines an abstract Arithmetic class with abstract subtraction methods and implements them in ArithmeticImpl.
2. Defines a Shape interface with draw and rotate methods. Circle and Rectangle classes implement Shape.
3. Defines a GeometryConstant interface and GeometryMethod interface. A Circle class implements both and defines area and circumference methods.
4. Defines an AccountInter interface with create, delete, and print methods. An Account class implements the interface and an AccountDemo class demonstrates its use.
The document contains 4 practice problems on object-oriented programming concepts like abstraction, interfaces, and inheritance:
1. Defines an abstract Arithmetic class with abstract subtraction methods and implements them in ArithmeticImpl.
2. Defines a Shape interface with draw and rotate methods. Circle and Rectangle classes implement Shape.
3. Defines a GeometryConstant interface and GeometryMethod interface. A Circle class implements both and defines area and circumference methods.
4. Defines an AccountInter interface with create, delete, and print methods. An Account class implements the interface and an AccountDemo class demonstrates its use.
1. Create a class Arithmetic which has following abstract methods:
public abstract int subtraction( int firstNo, int secondNo ) –
method to return subtraction of two integer numbers
public abstract int subtraction( int firstNo, int secondNo, int
thridNo) – method to return subtraction of three integer numbers
public abstract double subtraction( double firstNo, double
secondNo ) – method to return subtraction of two double numbers
public abstract double subtraction( int firstNo, double secondNo ) –
method to return subtraction of an integer and double number
public abstract float subtraction( float firstNo, float secondNo, float
thirdNo ) – method to return subtraction of three float numbers
Create a class ArithmeticImpl derived from Arithmetic.
Implement ( Override ) all the methods.
Create a class ArithmeticDemo having main method. Create an
object of ArithmeticImpl and call all subtraction methods.
2. Create an interface Shape having
following method: public void draw( ) public void rotate( )
Create a class Circle implementing Shape interface. draw( ) should
display message “Circle Drawn”. rotate( ) should display message “Circle Rotated”. Create a class Rectangle implementing Shape interface. draw() should display message “Rectangle Drawn”. rotate( ) should display message “Rectangle Rotated”.
Create a class TestShape having main method. Create an object of
Circle and Rectangle. Call draw and rotate methods to display appropriate messages. 3. Create an interface GeometryConstant which has one
member variable
double PI = 3.142
Create an interface GeometryMethod having following methods
double calArea ( double radius )
double calCircumference ( double radius )
Create a class Circle which should implement GeometryConstant
and GeometryMethod interfaces. Implement calArea and calCircumference methods.
Create a class TestCircle having main method. Create an object
of Circle. Ask user to enter value of radius through keyboard. Calculate area and circumference of a circle and print it.
4. Create an interface AccountInter having following methods
public void create( int accNo, String name, double accBal ) –
method to create an account public double delete( int accNo ) – method to delete an account passed as parameter public void print ( int accNo ) – method to print details of an account passed as parameter
Create a class Account which should implement AccountInter
interface and has following members: private int accNo private String name private double accBal
Create a class AccountDemo having main method. Create an
array of Account type of size 5 with name account. Ask user to enter account details through keyboard. Call create( ) to create an object of Account and store it in the array. Ask user to enter account number and call print ( ) to print details of that account Ask user to enter account number and call delete ( ) to delete details of that account.