Page 276 - ComputerScience_Class_11
P. 276
The output of the preceding program is as follows:
BlueJ: Terminal Window - Java
Options
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;
6 int bal;
7 void input() {
8 Scanner sc= new Scanner(System.in);
9 System.out.print("Enter Name of Customer : ");
10 cus_name=sc.nextLine();
11 System.out.print("Enter account number of Customer : ");
12 acno=sc.nextInt();
13 System.out.print("Enter type of account of Customer : ");
14 type_acc=sc.next().charAt(0);
274 Touchpad Computer Science (Ver. 3.0)-XI

