The document outlines the design of three classes: Bill, Bank, and Student, each with specific data members and methods for handling consumer billing, banking transactions, and student grades, respectively. The Bill class calculates electricity bills based on units consumed, the Bank class manages account details and transactions while ensuring a minimum balance, and the Student class accepts marks to compute averages and grades. Each class includes methods for data input, calculations, and displaying results, with a main method suggested for object creation and method invocation.
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 ratings0% found this document useful (0 votes)
4 views
class based program
The document outlines the design of three classes: Bill, Bank, and Student, each with specific data members and methods for handling consumer billing, banking transactions, and student grades, respectively. The Bill class calculates electricity bills based on units consumed, the Bank class manages account details and transactions while ensuring a minimum balance, and the Student class accepts marks to compute averages and grades. Each class includes methods for data input, calculations, and displaying results, with a main method suggested for object creation and method invocation.
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
Define a class Bill as described below:
Data members are:
name : to store the name of the consumer consumerno : to store the consumer number unitconsumed : to store the unit cosumed Member methods are : datainput() : to read the data of a person compute() : to calculate the bill amount as per criteria. Units Consumed Rate Up to 100 units 1.20 More than 100 and up to 200 units 2.20 107 Class as the Basis of All Computation More than 200 and up to 300 units 3.20 Above 300 units 4.00 Display() – To display the output as per the format: Consumer Name Consumer No Unit Consumed Bill Amount
Design class called Bank with the following descriptions:
Data members: name : to store the name of the depositor acno : to store the account number type : to store type of the account bal : to store the balance amount in the account Member functions: initialise( ) : to assign the data members with any value. depo(int a ) : where a is the amount to be deposited and the variable bal is to be updated. withdraw( int a) : where a is the amount to be withdrawn after checking the balance (Minimum balance should be ` 1000) and the variable bal is to be updated. print( ) : to print all the details. Write the main method to create the object of the class and call the above method.
Write a program with the following specifications:
Class name : Student Data members : name : To store the name of a student hindi : To store the marks in hindi subject english : To store the marks in english subject maths : To store the marks in mathematics computer : To store the marks in computer average : To store the avergae of the marks obtained grade : To store the grade depending upon the average. Member methods: void accept( ) : to accept name and marks in the 4 subjects. void calcavg( ) : to calculate and store the grade according to the following slabs: Average marks Grade Obtained 90 and above A++ Between 75 to 89 (both inclusive) A Between 60 to75 (both inclusive) B Less than 60 C Write the main method to create the object of the class and call the above method.