import java.util.*;
public class Account
{
	int choice,initbal,amt,total,withdraw;
	int ch;
	void Initbal()
	{
		Scanner sc=new Scanner(System.in);
		System.out.println("Enter Initial Balance (>200) : ");
		initbal=Integer.parseInt(sc.nextLine());
		while(initbal<200)
		{
			System.out.println("LOW BALANCE!!!Balance should be greater than Rs.200");
			System.out.println("Enter again : ");
			initbal=Integer.parseInt(sc.nextLine());
		}
	}

	void Detail()
	{
		Scanner sc=new Scanner(System.in);
		System.out.println("***************MENU***************");
		System.out.println("1. Deposit");
		System.out.println("2. Withdrawl");
		System.out.println("3. Account Details");
		System.out.println("4. Exit");
		System.out.println("Enter Choice : ");
		ch=Integer.parseInt(sc.nextLine());
		switch(ch)
		{
			case 1:
			{
			System.out.println("Enter Amount : ");
			amt=Integer.parseInt(sc.nextline());
			System.out.println("Amount Deposited Successfully!!!");
			total=initbal+amt;
			System.out.println("Total Balance = Rs." +total);
			break;
			}
			case 2:
			{
			System.out.println("Enter amount to be withdrawn : ");
			withdraw=Integer.parseInt(sc.nextLine());
			left=total-withdraw;
			if(left<=200)
			{
				System.out.println("Transaction Failed!!!");
				System.out.println("Your minimum balance should be Rs.200");
			}
			else
			{
				System.out.println("Transaction Successfull!!!");
				System.out.println("Your remaining balance is Rs." +left);
			}
			break;
		}
			case 3:
			{
				System.out.println("----------ACCOUNT DETAILS----------");
				System.out.println("NAME 				: " +name);
				System.out.println("AGE  				: " +age);
				if(choice==1)
				{
					System.out.println("SAVINGS");
				}
				else if(choice==2)
				{
					System.out.println("CURRENT");
				}
				else if(choice==3)
				{
					System.out.println("FIXED DEPOSIT");
				}
				else if(choice==4)
				{
					System.out.println("RECURRING DEPOSIT");
				}
				else
				{
					System.out.println("NULL");
				}

					System.out.println("ACCOUNT TYPE 	: " +choice);
					System.out.println("BALANCE 		:Rs." +total);

			break;
				}
			case 4:
			{
				System.out.println("EXIT.....");
				break;
			}
			default:
			{
				System.out.println("WRONG CHOICE!!!");

			}
		}


	int showData()
	{
		Scanner sc=new Scanner(System.in);

		System.out.println("------ACCOUNT TYPE------");
		System.out.println("1. Savings");
		System.out.println("2. Current");
		System.out.println("3. Fixed Deposit");
		System.out.println("4. Recurring Deposit");

		System.out.println("Enter Choice : ");
		choice=Integer.parseInt(sc.nextLine());
		switch(choice)
		{
			case 1:
			{
				System.out.println("-----WELCOME TO YOUR SAVINGS ACCOUNT-----");
				Initbal();
				Detail();
				break;
			}
			case 2:
			{
				System.out.println("-----WELCOME TO YOUR CURRENT ACCOUNT-----");
				Initbal();
				Detail();
				break;
			}
			case 3:
			{
				System.out.println("-----WELCOME TO YOUR FIXED DEPOSIT ACCOUNT-----");
				Initbal();
				Detail();
				break;
			}
			case 4:
			{
				System.out.println("-----WELCOME TO YOUR RECURRING DEPOSIT ACCOUNT-----");
				Initbal();
				Detail();
				break;
			}
			default:
			{
				System.out.println("ERROR!!!");
				System.exit(0);
				break;
			}
		}

public class Bank extends Account
{
				public static void main(String args[])
				{
					Account obj=new Account();

					Scanner sc=new Scanner(System.in);
					System.out.println("$$$$$$$$$$$$------WELCOME TO ABC BANK------$$$$$$$$$$$$");
					System.out.println("Enter Name	 : ");
					String name=sc.nextLine();
					System.out.println("Enter Age	 : ");
					int age=Integer.parseInt(sc.nextLine());
					while(age<18)
					{
						System.out.println("Age is less than 18!!!");
						System.out.println("Enter Age again : ");
						age=Integer.parseInt(sc.nextLine());
					}
					obj.showData();
				}
}

It would help if you would give some idea of
a) what this is meant to do
b) what it's doing that it shouldn't be doing, or what it isn't doing that it should be doing

It may seem obvious to you what it's meant to do, and perhaps I could guess, but then I might not be solving the right problem.
For (b), I could paste the code into an editor and compile it, but part of getting help is being specific about what you're asking for. "Fix the errors" is pretty vague.

You might want to read this piece for further help in getting help.

I have removed the errors from this code.basically,this is a bank management system program in which the user has to input name,age,account type,initial balance(which should b gr8r than 200),then the user can deposit,withdraw or see the account details.When the user runs the program 4 d first time,it runs smoothly but when the user wants to deposit money for the second time in the same round,it doesn't updates the previous value rather it calculates from the scratch..plz help...i hope u understood my point...

import java.util.*;
class Account
{
	int initbal=0;
	int amt=0;
	int total=0;
	int withdraw=0;
	int left=0;
	int choice,age,ch;
	String name;
	void Initbal()
	{
		Scanner sc=new Scanner(System.in);
		System.out.println("Enter Initial Balance (>200) : ");
		initbal=Integer.parseInt(sc.nextLine());
		while(initbal<200)
		{
			System.out.println("LOW BALANCE!!!Balance should be greater than Rs.200");
			System.out.println("Enter again : ");
			initbal=Integer.parseInt(sc.nextLine());
		}
	}

	void Detail()
	{
		while(ch!=4)
		{
			Scanner sc=new Scanner(System.in);
			System.out.println("   ");
			System.out.println("***************MENU***************");
			System.out.println("1. Deposit");
			System.out.println("2. Withdrawl");
			System.out.println("3. Account Details");
			System.out.println("4. Exit");
			System.out.println("Enter Choice : ");
			ch=Integer.parseInt(sc.nextLine());

		switch(ch)
		{
			case 1:
			{
				System.out.println("Enter Amount : ");
				amt=Integer.parseInt(sc.nextLine());
				System.out.println("Amount Deposited Successfully!!!");
				total=initbal+amt;
				System.out.println("Total Balance = Rs." +total);
				break;
			}
			case 2:
			{
				System.out.println("Enter amount to be withdrawn : ");
				withdraw=Integer.parseInt(sc.nextLine());
				left=total-withdraw;
				if(left<=200)
				{
					System.out.println("Transaction Failed!!!");
					System.out.println("Your minimum balance should be Rs.200");
				}
				else
				{
					System.out.println("Transaction Successfull!!!");
					System.out.println("Your remaining balance is Rs." +left);
				}
				break;
			}
			case 3:
			{
				System.out.println("----------ACCOUNT DETAILS----------");
				System.out.println("NAME 				: " +name);
				System.out.println("AGE  				: " +age);

				System.out.print("ACCOUNT TYPE 			: ");
				{
									if(choice==1)
									{
										System.out.print("SAVINGS");
									}
									else if(choice==2)
									{
										System.out.print("CURRENT");
									}
									else if(choice==3)
									{
										System.out.print("FIXED DEPOSIT");
									}
									else if(choice==4)
									{
										System.out.print("RECURRING DEPOSIT");
									}
									else
									{
										System.out.print("NULL");
									}
				}
								System.out.println(" ");
								total=total-withdraw;

				System.out.println("AVAILABLE BALANCE 		:Rs." +total  );
				break;
			}
			case 4:
			{
				System.exit(0);
				break;
			}
			default:
			{
				System.out.println("WRONG CHOICE!!!");

			}
		}
	}
}



	void showData()
	{
		Scanner sc=new Scanner(System.in);

		System.out.println("------ACCOUNT TYPE------");
		System.out.println("1. Savings");
		System.out.println("2. Current");
		System.out.println("3. Fixed Deposit");
		System.out.println("4. Recurring Deposit");

		System.out.println("Enter Choice : ");
		choice=Integer.parseInt(sc.nextLine());
		switch(choice)
		{
			case 1:
			{
				System.out.println("-----WELCOME TO YOUR SAVINGS ACCOUNT-----");
				System.out.println("   ");
				Initbal();
				Detail();
				break;
			}
			case 2:
			{
				System.out.println("-----WELCOME TO YOUR CURRENT ACCOUNT-----");
				System.out.println("   ");
				Initbal();
				Detail();
				break;
			}
			case 3:
			{
				System.out.println("-----WELCOME TO YOUR FIXED DEPOSIT ACCOUNT-----");
				System.out.println("   ");
				Initbal();
				Detail();
				break;
			}
			case 4:
			{
				System.out.println("-----WELCOME TO YOUR RECURRING DEPOSIT ACCOUNT-----");
				System.out.println("   ");
				Initbal();
				Detail();
				break;
			}
			default:
			{
				System.out.println("   ");
				System.out.println("ERROR!!!");
				System.exit(0);
				break;
			}
		}
	}
}

public class Bank extends Account
{
				public static void main(String args[])
				{
					Account obj=new Account();

					Scanner sc=new Scanner(System.in);
					System.out.println("$$$$$$$$$$$$------WELCOME TO ABC BANK------$$$$$$$$$$$$");
					System.out.println("   ");
					System.out.println("Enter Name	 : ");
					obj.name=sc.nextLine();
					System.out.println("Enter Age	 : ");
					obj.age=Integer.parseInt(sc.nextLine());
					while(obj.age<18)
					{
						System.out.println("Age is less than 18!!!");
						System.out.println("Enter Age again : ");
						obj.age=Integer.parseInt(sc.nextLine());
					}
					obj.showData();
				}
}

Unless there's some other code somewhere else, this code creates an Account object and updates it IN MEMORY. When the program exits, all that info is lost, so next time you run it you are back to square 1 again.
To keep the account info from one run to the next you need code to write it out to a file or database, and read it back in next time.
Probably the easiest way is to use ObjectOutputStream and ObjectInputStream to write the whole Account object to a file in one go. You'll find examples etc. via Google.

Even in 1 run you will have problems because in detail() you calculate various variables such as "left", but you do not consistently update a single variable that represents the current balance.

thanx 4 ur suggestion...but wil u plz elaborate by correcting this code..it will help me a lot...thnku.

It's your code, and you have to fix it. Have a variable for current balance and for every transaction of every kind, update the current Balance.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.