exception in thread!

i key in this program and it has no errors...however the program cannot run...any reason why it says exception in thread?

public class CreditCard implements CardInterface {
 
  // Instance variables;
  private String number;
  private String name;
  private String bank;
  protected double balance;
  private int limit;
 
  // Constructor
  CreditCard(String no, String nm, String bk, double bal, int lim) {
    number = no;
    name = nm;
    bank = bk;
    balance = bal;
    limit = lim;
  }
 
  // Accessor methods
  public String getNumber()      { return number; }
  public String getName()      { return name; }
  public String getBank()      { return bank; }
  public double getBalance()       { return balance; }
  public int getLimit()       { return limit; }
 
  // Action methods
  public boolean chargeIt(double price) {       // Make a charge
    if (price + balance > (double) limit)
      return false;      // Not enough money left to charge it
    balance += price;
    return true;      // The charge is accepted
  }
  public void makePayment(double payment) {      // Make a payment
    balance -= payment;
  }
  public void print() {                        // Print a card's info
    System.out.println("Number = " + getNumber());
    System.out.println("Name = " + getName());
    System.out.println("Bank = " + getBank());
    System.out.println("Balance = " + getBalance());
    System.out.println("Limit = " + getLimit());
  }
}
   
basgenAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CEHJConnect With a Mentor Commented:
>>this is the creditcard class file:

You're trying to post the binary. You should be posting the source code *of the class calling the CreditCard class*
0
 
girionisCommented:
How do you run the programme? I cannot see any main method? You should run a class that has a main method in it.
0
 
PriestexCommented:
The problem doesnt seem to be in this class.
Its probably becuause of the code that you are calling this class from.

Can you post that.
And also the definition of the interface you are implementing in this class.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
basgenAuthor Commented:
this is the creditcard class file:

Êþº¾












getBalance
SourceFile
Balance =
CreditCard


0
 
basgenAuthor Commented:
seems to have more errors man
0
 
girionisCommented:
> this is the creditcard class file:

I can't see anything, what encoding are you using?
0
 
Mayank SAssociate Director - Product EngineeringCommented:
Same here. There must be another class that has a main () method - search for that one and run it.

Searching will be easier if you have some IDE like Eclipse, so download it - www.eclipse.org
0
 
Mayank SAssociate Director - Product EngineeringCommented:
? What was the problem and what was the solution?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.