NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//QUE7

import java.util.Scanner;
class Data{
String name;
String type;
long account_number;
long balance;

// initializing
void initial_value(String AC_holder_name, String ACtype){
this.name = AC_holder_name;
this.type = ACtype;
this.account_number = 00000001;
this.balance = 0;

}
//deposite
void deposit(long ammount){
this.balance = this.balance + ammount;
System.out.println("Balance: " + this.balance);
}

// withdraw
void withdraw(long amount_to_wthdrw ){

//check balance
System.out.println("Balance: " + this.balance);
if (amount_to_wthdrw < this.balance ){
this.balance = this.balance - amount_to_wthdrw;
System.out.println("Withdraw Successfully! current Balance: " + this.balance);
}
else{
System.out.println("Not Enough money!");
}


}

void display(){
//name and balance
System.out.println("Account Holder name: " + this.name);
System.out.println("Balance : " + this.balance);
System.out.println("Account Type: " + this.type );

}
}

class First{

public static void main(String args[]){

Scanner scan = new Scanner(System.in);
Scanner scanl = new Scanner(System.in);
Scanner scani = new Scanner(System.in);
Data d = new Data();
int ch = 0;
do{
System.out.print(" 1 for account openingn 2 for withdraw amountn 3 for depositn 4 for show balancen 0 for QUITnChoose An Option: " );
ch = scani.nextInt();
switch(ch){
case 1:
System.out.print("Enter name: ");
String name = scan.nextLine();
String type = "Not selected";
System.out.print("Choose an option:n1 for Savingn2 for Current: ");
int choice = scani.nextInt();
switch (choice){
case 1:
type = "Saving Account";
break;
case 2:
type = "Current Account";
break;
default:
System.out.println("Invalid option! Exiting...");
System.exit(0);
}

String Type = type;
d.initial_value(name, Type);
break;
case 2:

System.out.print("How Much amount you want to withdraw: ");
long amount = scanl.nextInt();
d.withdraw(amount);
break;
case 3:
System.out.print("How much amount you want to deposit: ");
long amnt = scanl.nextInt();
d.deposit(amnt);
break;
case 4:
d.display();
break;
case 0:
System.exit(0);
default:
System.out.println("Invalid option! Exiting...");
System.exit(0);

}
}while(ch != 0);




}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.