Created
August 19, 2015 09:09
-
-
Save yaswanthrajyadiki/e2827c04a7a21c26fd51 to your computer and use it in GitHub Desktop.
Small Account problem using basic concepts in java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class Bookshelf here. | |
* | |
* @author (your name) | |
* @version (a version accountNumber or a date) | |
*/ | |
public class Account | |
{ | |
private String name; | |
private int accountNumber; | |
private String address; | |
private int mobile; | |
private int balance; | |
private String date; | |
private String time; | |
public Account(String n,int num,String add,int m) | |
{ | |
name=n; | |
accountNumber=num; | |
address=add; | |
mobile=m; | |
date=""; | |
time=""; | |
} | |
public void credit(int amount,String d, String t) | |
{ | |
balance=balance+amount; | |
date=d; | |
time=t; | |
System.out.println("Credited:"+amount); | |
System.out.print("Balance: "+balance); | |
System.out.print("Date: "+date); | |
System.out.println("Time: "+time); | |
} | |
public void debit(int amount ,String d,String t) | |
{ | |
balance=balance-amount; | |
date=d; | |
time=t; | |
System.out.println("Debited :"+amount); | |
System.out.print("Balance: "+balance); | |
System.out.print("Date: "+date); | |
System.out.println("Time: "+time); | |
} | |
public static void main(String args[]) | |
{ | |
Account amy =new Account("amy",00003672,"Hyd",490342334); | |
amy.credit(100000,"18/12/2015","02:13"); | |
amy.debit(10000,"20/12/2015","20:13"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment