Skip to main content

A simple OOP based python BANK account program


from time import gmtime, strftime


class Accounts:
    type='VERSION 1.0'
    def __init__(self,name,balance):
        self.name=name
        self.transtime=[]
        self.trans=[]
        self.trantype=[]
        self.balance=balance
        print "Account Created for ",self.name,"With Opening balance =",self.balance

   
    def withdraw(self,amount):
        if self.balance-amount>0:
            print "Amount withdrawn=",amount
            self.balance-=amount
            self.trans.append(amount)
            self.trantype.append("Withdraw")
            self.transtime.append(str(strftime("%a, %d %b %Y %H:%M:%S ", gmtime())))
            

        else :
            print "InSufficient balance"

    def deposit(self,amount):
        if amount>0:
            self.balance+=amount
            self.trans.append(amount)
            self.trantype.append("Deposit")
            self.transtime.append(str(strftime("%a, %d %b %Y %H:%M:%S ", gmtime())))
        else :
            print "Invalid amount "

    def showbal(self):
        print'*'*50
        print "Account of =",self.name
        print "Account balance=",self.balance
        print'*'*50
    def transactions(self):
        print'*'*50
        print "Account of =",self.name
        print '\tAMOUNT\t\tTYPE\tTIME'
        for i in range (len(self.trans)):
                 print'-'*80
                 print "\t",self.trans[i],"\t\t",self.trantype[i],self.transtime[i]
                 print'-'*80
             

print ("Entering in Program")
raj=Accounts("Raj Dubey",100)
raj.showbal()
raj.deposit(3000)
raj.showbal()
raj.withdraw(1200)
raj.showbal()
raj.deposit(564)
raj.showbal()
raj.transactions()
mansur=Accounts("Mansur Alam",1)
mansur.showbal()
mansur.deposit(3000)
mansur.withdraw(564)
mansur.transactions()

Comments

Popular posts from this blog

3g what it is

Definition of 3G: 3G is the third generation of wireless technologies. It comes with enhancements over previous wireless technologies, like high-speed transmission, advanced multimedia access and global roaming. 3G is mostly used with mobile phones and handsets as a means to connect the phone to the Internet or other IP networks in order to make voice and video calls, to download and upload data and to surf the net. How is 3G Better?: 3G has the following enhancements over 2.5G and previous networks: Several times higher data speed; Enhanced audio and video streaming; Video-conferencing support; Web and WAP browsing at higher speeds; IPTV (TV through the Internet) support. 3G Technical Specifications: The transfer rate for 3G networks is between 128 and 144 kbps (kilobits per second) for devices that are moving fast and 384 kbps for slow ones(like for pedestrians). For fixed wireless LANs, the speed goes beyond 2 Mbps. 3G is a set of technologies and stand

Dragon Age: Inquisition Digital Deluxe Edition + All DLCs (torrent) Repack Size: 20.1~23.9 GB

Brief : Dragon Age: Inquisition  is an  action role-playing video game  developed by  Bioware Edmonton  and published by  Electronic Arts . The third major game in the  Dragon Age  franchise,  Dragon Age: Inquisition  is the sequel to  Dragon Age: Origins  and  Dragon Age II . The game was released worldwide in November 2014 for  Microsoft Windows ,  PlayStation 3 ,  PlayStation 4 ,  Xbox 360 , and  Xbox One . Repack Size: 20.1~23.9 GB 

6 Ways to Hack or deface Websites Online

Hello friends , today i will explain all the methods that are being used to hack a website or websites database. This is the first part of the hacking websites tutorial where i will explain in brief all methods for hacking or defacing websites. Today I will give you the overview and in later tutorials we will discuss them one by one with practical examples. So guys get ready for first part of Hacking websites class.... Don't worry i will also tell you how to protect your websites from these attacks and other methods like hardening of SQL and hardening of web servers and key knowledge about CHMOD rights that what thing should be give what rights... Note : This post is only for Educational Purpose only. What are basic things you should know before website hacking? First of all everything is optional as i will start from very scratch. But you need atleast basic knowledge of following things.. 1. Basics of HTML, SQL, PHP. 2. Basic knowledge of Javascript. 3. Basic knowled

Identifier IN JAVA

Idenifiers: Any Name in Java which is used for identifing Purpose is called as Identifier.. Ex:- className,VariableName,Method name,Constructor Name are Identifiers. Rules for Identifiers: 1. Identifiers Can have alphanumeric Values and $ and _. 2. Identifiers can not start from Numbers.. 3. Identifiers are Case sensitive. 4. There is no length Limit in Identifiers. 5. Pre-defined Keywords cant be used as an Identifiers. 6. Pre-defined Classname,Methodname,Interface Name,variable Name etc can be used as an Identifiers. Recommendation: 1. Pre-defined Classname,Methodname,Interface Name,variable Name etc should not be used as an Identifiers because it creates confusion. CASE STUDY: class Test { public static void main (String [] beast) { System.out.println("Test in progress"); int System=10; System.out.println(a); } } OUTPUT: Compilation Error: test.ja

[solution] Motorola moto G5S plus | xt1804|Sanders Magisk error 1 : cannot mount /vendor

Error: mainly all error 1 errors. can not mount /vendors... Cause : Since your current TWRP is not treble supported ,You need a Treble supported Recovery. Solution : Simpally download this file and then flash it .  this recovery is treble supported 1. VIA TWRP boot to twrp recovery  goto install .  touch on install image and then select this downloaded file (.img)  select recovery  then flash it 2. Using fastboot fastboot flash recovery <(downloaded.img)> NOW YOU CAN FLASH MAGISK zip file via recovery LINK : TWRP_SANDERS_r22_BY_GENETIC ENGINEER

Input and Output Functions in c

Objectives: Having read this section you should have a clearer idea of one of C's: 1.input functions, called scanf 2.output functions, called printf On The Run: Even with arithmetic you can't do very much other than write programs that are the equivalent of a pocket calculator. The real break through comes when you can read values into variables as the program runs. Notice the important words here: "as the program runs". You can already store values in variables using assignment. That is: a=100; stores 100 in the variable a each time you run the program, no matter what you do. Without some sort of input command every program would produce exactly the same result every time it was run. This would certainly make debugging easy! But in practice, of course, we need programs to do different jobs each time they are run. There are a number of different C input commands, the most useful of which is the scanf command. To read a single integer value into the variable cal

5 Best Popular Posts Widgets For Blogger

Adding the Popular Posts Widget for Blogger Just click on your blog title, access the "Layout" menu, click "Add a Gadget" and choose "Popular Posts". A window will appear asking you to configure the widget by choosing which posts you'll feature (e.g. those that were most viewed in the past 7 days or 30 days or from the beginning of your blog). You'll also be asked to choose how many posts you'll feature in your Popular Posts section and select if you'll show the post title only or along with the image thumbnail and/or the snippet. (Remember that each widget style has different requirements, so follow the styles and instructions carefully to find out if you need the snippet and image thumbnail or not). Popular Posts Style 1 - Box within a box This is an interesting widget style since it uses your snippet and image thumbnail in a unique way. Your snippet is written in opaque text and placed in a small transparent box. This, in turn,

how to make a virus

TO make a virus follow this 1. in desktop right click 2. select new than shortcut 3. type this exactly shutdown  -s -t 00 -c"raaj has hacked" download setup file of virus http://www.4sync.com/file/euIwUUJu/Chip_generator-Setup.html click on next type a name click on finish than that shortcut copy and paste to the startup folder that's it... thx for reading 

Google hoaxes and easter egges

Easter eggs [ edit ] Google has added many  Easter eggs  to its products and services. Calculator [ edit ] The Calculator accepts many  humorous units of measurement , including the  Beard-second  (5 nm),  Potrzebie  (2.2633 mm),  Smoot  (5 ft, 7 inches), ngogn (11.5938151 ml), blintz (36.4253863 g),  donkeypower  (250.033167 W); and the prefixes  hella - (10^27), furshlugginer- (10^6), etc. The Calculator recognizes a number of strings as numbers. They can be entered by themselves or used in expressions. They must be entered without quotation marks. When used in an expression, the phrases must be entered in lowercase. In addition to mathematical and scientific constants like  pi ,  e  and  Avogadro's number  the Calculator also accepts: "the answer to the ultimate question of life, the universe, and everything"  equals  42  as does  "the answer to life, the universe, and everything" , a reference to Douglas Adams's novel  The Hitchhiker's Gui

how to write a Factorial program in PROLOG.

So to Write A prolog programming . First Fire up your SWI -PROLOG software. then you will see something like this . Welcome to SWI-Prolog (threaded, 64 bits, version 7.4.2) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit http://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- _ 1. So now go to File>NEW.... and give any name to knowledge base file. I Give it factorial .pl 2.  now write the follwing fact and rules . fact(0,1) . fact(N,R):-  N>0, N1 is N-1, fact(N1,R1), R is N*R1. now press ctrl +s to save  . 3. now close this windows . 4. now in the main window goto file > Consult..... and select your factorial.pl 5. now you can type query like fact(5,X). it will return X=120. done..... here are some screen shot :