Page 223 - computer science (868) class 11
P. 223
28 System.out.println("Average:"+ avg_marks);
29 }
30 public static void main(String args[])
31 {
32 student_marks ob=new student_marks();
33 ob.accept();
34 ob.compute();
35 ob.display();
36 }
37 }
The output of the preceding program is as follows:
Enter your name:
PRIYANSHU SAHA
Enter marks in 2 subjects:
99
98
Enter your age:
16
Name of the student : PRIYANSHU SAHA Age : 16
Marks:99,98
Maximum Marks:99
Average:98.5
Program 5 Design a class called Banking_system with the following specifications:
Data Members
cus_name : to store the name of the depositor
accno : to store the account number
type_acc : to store the type of the account(s/c)
bal : to store the balance amount in the account
Member Functions
void input( ) : to input data to all the data members
(Minimum balance Rs.1000)
void deposit(int d) : to deposit the amount d and update the balance
void withdraw(int w) : to withdraw the amount a and update the balance
void print( ) : to print all the details
Write the main method to create an object of the class and call the above methods.
1 import java.util.*;
2 class Banking_system {
3 String cus_name;
4 long acno;
5 char type_acc;
221
Methods and Constructors 221

