In this exercise, you will create the CAccount class that handles the financial transaction for buying a book. The following table shows the methods and properties you will implement for the CAccount class.

Name Type Purpose
Price Property The price of the book a student wants to purchase.
Authorize Method Looks up a student's account balance. If the balance plus the price of the book is less than $500, this method returns success.
Debit Method Adds the book price to a student's account balance.
Warning Event Sends notification that a student's account balance is greater than $450.
Memo Property A memo to be used when writing the account log.

Create the CAccount Class

  1. Open the StateUBookstore project.

  2. Run the Class Builder Add-In.

  3. Create a new class named CAccount.

  4. Add the Price property as a Public property. Set the data type to Double.

  5. Add the Authorize method. This method has an Integer argument called iStudentID. Set the return type to Boolean.

  6. Add the Debit method. This method has an Integer argument called iStudentID. Set the return type to Boolean.

  7. Add the Warning event. Add a String argument called Message to this event.

  8. Add the Memo property as a Public property. Set the data type to String.

  9. On the File menu, click Update Project to write changes into the StateUBookstore project.

  10. Exit the Class Builder.

  11. Open the Object Browser and examine the CAccount class. Make sure the properties and methods of the class look the way you expect them to.

  12. Save the project.