compile error..(yes another)

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
eus
Posts: 2
Joined: Fri Dec 02, 2005 10:04 pm

compile error..(yes another)

Post by eus »

finally got my code to compile ..and run but i keep getting this error message on scren when i run it..

Please enter your age java.io.IOException: The handle is invalid

oh and by the way this is my code..

Code: Select all

*The bank wants to give away some money!
However there are some conditions that must be fulfilled:

To qualify, the customer must be over 18 and
They must have been with the bank for more than 5 years or
They must have a balance greater than 100 in their accounts.

Write a program that reads in this information, and lets the customer know whether they are in for some money or not.

Extend this program as follows:
If the customer does qualify, inform them how much money they will get:
"	If their balance is greater than 100, then they get 2000
"	If their balance is greater than 50, (but less than or equal to 100), then they get 1000
"	If their balance is positive (but less than or equal to 50) then they get 500
"	Finally if their balance is negative they are told to put some money in their account*/

public class Bank
{
	public static void main (String [] args)
	{
		int age, years;
		double balance;

		ConsoleReader console = new ConsoleReader(System.in);

		//prompt user for data
		System.out.print("Please enter your age ");
		age = console.readInt ();

		if(age <18)
			System.out.print("sorry you must be 18 or over to to be eligible for a loan ");

		else
		System.out.print("please enter the number of years you have been with this bank ");
		years = console.readInt ();

			if(years >5)
				System.out.print("congratulations you qualifiy and you get 1000 euro ");

			else
				System.out.print("please enter your account balance ");
				balance = console.readDouble ();

				if(balance >100)
					System.out.print("congratulations you qualifiy and you get 1000 euro ");
				else
					System.out.print("sorry you are not eligible for a loan ");
				}
			}
just cant seem to go past the first line,...
something to do with reading input??
User avatar
talleyrand
Posts: 625
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

If you are attempting to run the program from within TextPad, I believe that will be your issue. Last I recall, you cannot touch the file streams from within but I could be off. Try executing the code from the command line.

java Bank
I choose to fight with a sack of angry cats.
Post Reply