Posts

Showing posts with the label inheritance program in java

Bank Inheritance Program ISC Specimen 2023 Theory

A super class Bank has been defined to store the details of the customer in a bank. Define a subclass Interest to calculate the compound interest. The details of the members of both the classes are given below: Class name : Bank Data members/instance variables : name: to store the name of the customer accNo: integer to store the account number principal: to store the principal amount in decimals Methods/member functions : Bank(...): parameterized constructor to assign values to the data members void display(): to display the customer details Class name : Interest Data members/instance variables : rate: to store the interest rate in decimals time: to store the time period in decimals Methods/member functions : Interest(...): parameterized constructor to assign values to the data members of both the classes double calculate(): to calculate and return the compound interest using the formula: CI = P(1 + R / 100) N - P, where P is the principal, R is the rate and N is the time void displ...

Item Inheritance ISC Computer Science 2022 Semester 2 Theory

A super class Item has been defined to store the details of an item sold by a wholesaler to a retailer. Define a subclass Taxable to compute the total amount paid by the retailer along with service tax. Some of the members of both the classes are given below: Class name : Item Data members/instance variables : name: to store the name of the item code: integer to store the item code amount: stores the total sale amount of the item (in decimals) Member functions/methods : Item(...): parameterized constructor to assign values to the data members void show(): to display the item details Class name : Taxable Data members/instance variables : tax: to store the service tax (in decimals) totamt: to store the total amount (in decimals) Member functions/methods : Taxable(...): parameterized constructor to assign values to the data members of both the classes void calTax(): calculates the service tax @ 10.2% of the total sale amount. Calculates the total amount paid by the retailer as (total sa...