creditcard class defines five instance variablesall of which are private to the classand it provides simple constructor that initializes these instance variables it also defines five accessor methods that provide access to the current values of these instance variables of coursewe could have alternatively defined the instance variables as being publicwhich would have made the accessor methods moot the disadvantage with this direct approachhoweveris that it allows users to modify an object' instance variables directlywhereas in many cases such as thiswe prefer to restrict the modification of instance variables to special update methods we include two such update methodschargeit and makepayment in code fragment in additionit is often convenient to include action methodswhich define specific actions for that object' behavior to demonstratewe have defined such an action methodthe printcard methodas static methodwhich is also included in code fragment the test class we test the creditcard class in test class note the use of an arraywalletof creditcard objects hereand how we are using iteration to make charges and payments we show the complete code for the test class in code fragment for simplicity' sakethe test class does not do any fancy graphical outputbut simply sends its output to the java console we show this output in code fragment note the difference between the way we utilize the nonstatic chargeit and make-payment methods and the static printcard method code fragment the creditcard class