Help with credit card method, OOP

I am new to OOP, i am not sure if this is the correct approach or not. Need some insight.

Assignment 3
Write a class named CreditCard that has (at least) the following member variables:

name. A String that holds the card holder’s name.
cardNumber. A field that holds the credit card number.
balance. A double that stores the current credit card balance.
spendingLimit. A double that stores the spending limit of the card holder.
Bonus: additional fields that you can think of.

In addition, the class should have the following member functions:

Constructor. The constructor should accept the card holder’s name and card number and assign these values to the object's corresponding member variables. The constructor should initialize the spending limit to $2,000 and the balance to $0.
Accessors. Appropriate accessor functions should be created to allow values to be retrieved from an object's member variables.
purchase. This function should add the amount specified as a parameter to the balance member variable each time it is called.
increaseSpendingLimit. This function should add 500 to the spendingLimit member variable each time it is called.
payBill. This function should reset the balance to 0.
Input validation: Whenever a credit card number is modified, verify that it is of reasonable length.

Demonstrate the class in a program that creates a CreditCard object and allows the user to change and view the state of the credit card with a menu driven program.

View Card Information.
Purchase an Item: ask the user the purchase amount and increase the card balance accordingly.
Pay Bill: call payBill method to set the balance to 0.
Increase Spending Limit: ask the user how much the spending limit should be, and call the increaseSpendingLimit function the appropriate number of times.

All you have verified here is the length of the String cardNum. If you were to enter here: "abcdefghijklmno", your validation would consider it to be a valid cardnumber, which, it obviously isn't.
Then you print "Valid card number" and assign the value of c to cardNumber. (Even if the value of c would be -15, which is not a valid card number)

else
{
System.out.println("Error: Invalid card number");
}

Here, all you say is that the length of the cardNum String doesn't meet the requirements.

You don't need to ask a new String, you need to validate it on c.

Problem number two: in order to validate the String, you need to check that c is:

c <= 9999999999999999
AND
c => 1000000000000

Unfortunately, even the smallest of these values, does exceed the limitations of an int, so, you'll need an other datatype. If you want to stick to primitive types, float would be sufficient. However, since there is additional validation possible on cardnumbers, you may also want to create a seperate datatype and implement it all in there (just a thought).

But, are you sure you were supposed this in Java ? Java doesn't have functions, it has methods. Are you using another language in your course, or is this just an oversight of the lecturer?