{"id":258,"date":"2024-02-20T14:36:58","date_gmt":"2024-02-20T14:36:58","guid":{"rendered":"https:\/\/xojo.itbib4you.be\/?page_id=258"},"modified":"2024-11-27T07:26:27","modified_gmt":"2024-11-27T07:26:27","slug":"the-account-class","status":"publish","type":"page","link":"https:\/\/xojo.itbib4you.be\/index.php\/the-account-class\/","title":{"rendered":"The Account Class"},"content":{"rendered":"\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button has-custom-width wp-block-button__width-25 has-custom-font-size is-style-fill has-small-font-size\"><a class=\"wp-block-button__link has-light-green-cyan-to-vivid-green-cyan-gradient-background has-background wp-element-button\" href=\"https:\/\/xojo.itbib4you.be\/\">Overview<\/a><\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>In this lesson we will define the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Account <\/mark>class as discussed in the previous lesson. Member data (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">properties<\/mark>) will be added to the class and member <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">methods<\/mark> are developed and inserted into the class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How define a new Class?<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"784\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_17.png\" alt=\"\" class=\"wp-image-259\" style=\"width:195px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_17.png 480w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_17-184x300.png 184w\" sizes=\"auto, (max-width: 480px) 85vw, 480px\" \/><\/figure>\n<\/div>\n\n\n<p>A new class can be inserted in a program by selecting <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Class<\/mark> from the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Insert<\/mark> button on the toolbar (see <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">red<\/mark> arrow on screenshot) or from the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Insert<\/mark> menu item.<\/p>\n\n\n\n<div style=\"height:2px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"292\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_18.png\" alt=\"\" class=\"wp-image-262\" style=\"width:195px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_18.png 602w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_18-300x146.png 300w\" sizes=\"auto, (max-width: 602px) 85vw, 602px\" \/><\/figure>\n<\/div>\n\n\n<p>In the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Inspector<\/mark> we change the default name of the class (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Class1<\/mark>) into <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Account<\/mark>.<\/p>\n\n\n\n<div style=\"height:1px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Add a property to a Class<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"811\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_19-1024x811.png\" alt=\"Insert property\" class=\"wp-image-267\" style=\"width:319px;height:auto\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_19-1024x811.png 1024w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_19-300x238.png 300w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_19-768x608.png 768w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_19.png 1056w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n<\/div>\n\n\n<p>To add a property to the class, you must first select the class in the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Navigator<\/mark>. The small <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">+<\/mark> button above the coding pane (see <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">blue<\/mark> arrow on the screenshot) allows you to add various code items (Menu Handler, Method, Note, Property&#8230;). Select <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Property<\/mark> (see <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">red<\/mark> arrow on the screenshot).<\/p>\n\n\n\n<div style=\"height:2px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"286\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_20-1.png\" alt=\"\" class=\"wp-image-273\" style=\"width:195px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_20-1.png 596w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_20-1-300x144.png 300w\" sizes=\"auto, (max-width: 596px) 85vw, 596px\" \/><\/figure>\n<\/div>\n\n\n<p>In the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Inspector<\/mark> we can change the characteristics of the new property:  the default <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Name<\/mark> (default <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Untitled<\/mark>) into <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountBalance<\/mark> , the default data <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Type<\/mark> (default <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Integer<\/mark>)  into <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Currency<\/mark> and we limit the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Scope<\/mark> of the property to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Private<\/mark>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-yellow-background-color has-background\" style=\"line-height:1.4\">It is good practice to set properties and methods to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Private<\/mark> if they are not needed outside the class.<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Add a method to a Class<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"811\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_21-1024x811.png\" alt=\"\" class=\"wp-image-276\" style=\"width:319px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_21-1024x811.png 1024w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_21-300x238.png 300w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_21-768x608.png 768w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_21.png 1056w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n<\/div>\n\n\n<p>To add a method to a class, you must first select the class in the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Navigator<\/mark>. The small <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">+<\/mark> button above the coding pane (see <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">blue<\/mark> arrow on the screenshot) allows you to add various code items (Menu Handler, Method, Note, Property&#8230;). Select <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Method<\/mark> (see <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">red<\/mark> arrow on the screenshot).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">DepositMoney<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"466\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_22.png\" alt=\"\" class=\"wp-image-280\" style=\"width:319px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_22.png 600w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_22-300x233.png 300w\" sizes=\"auto, (max-width: 600px) 85vw, 600px\" \/><\/figure>\n<\/div>\n\n\n<p>Now, the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Method Name<\/mark>, the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Parameters<\/mark>, the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Return Type<\/mark> and the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Scope<\/mark> of the new method can be defined in the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Inspector<\/mark> (see screenshot).<\/p>\n\n\n\n<div style=\"height:1px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Method Name<\/mark>: the name of the method. This name must be used in the code to call the method;<\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Parameters<\/mark>: the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">name<\/mark> and <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">data type<\/mark> of variables that will receive data passed from the  calling code. Parameters are separated by commas. These variables will be used in the new method (for instance <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">amount As Currency<\/mark> : amount is a variable (parameter) that can be used in the method);<\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Return Type<\/mark>: some methods will return a value to the line of code that called the method. The <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Return Type<\/mark> specifies the data type of the returned value;<\/li>\n\n\n\n<li><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Scope<\/mark>: indicates the accessibility (public, private, protected) of the method in the application.<\/li>\n<\/ul>\n\n\n\n<p>The method code can be entered in the blank code editor. Our code is simple: increase the property <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountBalance<\/mark> with the deposited value available in the parameter <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">amount<\/mark>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\">AccountBalance = AccountBalance + amount<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">WithdrawMoney<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"468\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_23.png\" alt=\"\" class=\"wp-image-284\" style=\"width:319px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_23.png 600w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_23-300x234.png 300w\" sizes=\"auto, (max-width: 600px) 85vw, 600px\" \/><\/figure>\n<\/div>\n\n\n<p>The definition of the method <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">WithdrawMoney<\/mark> is similar to the previous definition.<\/p>\n\n\n\n<div style=\"height:1px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>However, no more money can be withdrawn than the balance of the account. The following code has been entered in the code editor:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">\/\/the value of amount cannot be greater than the value of AccountBalance<\/mark>\nIf amount > AccountBalance Then\n  amount = AccountBalance\nEnd If\nAccountBalance = AccountBalance - amount<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted has-yellow-background-color has-background\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">\/\/<\/mark> Is used to add comments to the code<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">GetBalance<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"596\" height=\"480\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_24.png\" alt=\"\" class=\"wp-image-288\" style=\"width:319px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_24.png 596w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_24-300x242.png 300w\" sizes=\"auto, (max-width: 596px) 85vw, 596px\" \/><\/figure>\n<\/div>\n\n\n<p>Since the property <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountBalance<\/mark> is a private property, we need a public method (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">GetBalance<\/mark>) to access this private property. The method <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">GetBalance<\/mark> will return the value of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountBalance<\/mark> (data type <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Currency<\/mark>) to the calling line of code.<\/p>\n\n\n\n<div style=\"height:1px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The code in the code editor is limited to one line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Return<\/mark> AccountBalance<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">The AccountWindow<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"380\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_25b.png\" alt=\"AccountWindow\" class=\"wp-image-331\" style=\"width:297px;height:auto\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_25b.png 500w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_25b-300x228.png 300w\" sizes=\"auto, (max-width: 500px) 85vw, 500px\" \/><\/figure>\n<\/div>\n\n\n<p>The window named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountWindow<\/mark> contains 3 buttons and one label:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Button named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">DepositButton<\/mark> with Caption &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Deposit<\/mark>&#8216; (Scope = Private);<\/li>\n\n\n\n<li>Button named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">WithdrawButton<\/mark> with Caption &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">WithDraw<\/mark>&#8216; (Scope = Private);<\/li>\n\n\n\n<li>Button named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">ShowButton<\/mark> with Caption &#8216;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-blue-color\">Balance<\/mark>&#8216; (Scope = Private);<\/li>\n\n\n\n<li>Label named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">BalanceLabel<\/mark> with empty Text property (Scope = Private).<\/li>\n<\/ul>\n\n\n\n<p>To simplify our application, we use fixed amounts to deposit (1500.00) and withdraw (275.00).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CheckingAccount<\/h3>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"598\" height=\"284\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_26a.png\" alt=\"\" class=\"wp-image-334\" style=\"width:319px\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_26a.png 598w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_26a-300x142.png 300w\" sizes=\"auto, (max-width: 598px) 85vw, 598px\" \/><\/figure>\n<\/div>\n\n\n<p>To create a reference variable <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">CheckingAccount<\/mark> we can add a <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Private<\/mark> property to <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountWindow<\/mark>. This declaration creates an empty (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Nil<\/mark>) variable. The  variable will be accessible by all methods of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountWindow<\/mark>. To create an instance of the class <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Account<\/mark> the reference variable has to refer to the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Account<\/mark> Class. This can be done with the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">New<\/mark> keyword.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignleft size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"309\" src=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_27-1024x309.png\" alt=\"\" class=\"wp-image-317\" style=\"width:401px;height:auto\" srcset=\"https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_27-1024x309.png 1024w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_27-300x90.png 300w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_27-768x231.png 768w, https:\/\/xojo.itbib4you.be\/wp-content\/uploads\/2024\/02\/Xojo_27.png 1062w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n<\/div>\n\n\n<p>In the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Opening<\/mark> event of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountWindow<\/mark> we can instantiate <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">CheckingAccount<\/mark>with the following statement:<\/p>\n\n\n\n<div style=\"height:1px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\">CheckingAccount =  New Account<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">DepositButton: Pressed<\/h3>\n\n\n\n<p>The <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Pressed<\/mark> event of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">DepositButton<\/mark> must increase the balance of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">checkingAccount<\/mark>with the value (1500.00) copied to the parameter <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">amount<\/mark>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\">CheckingAccount.DepositMoney(1500.00)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">WithdrawButton: Pressed<\/h3>\n\n\n\n<p>The <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Pressed<\/mark> event of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">WithdrawButton<\/mark> must decrease the balance of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">checkingAccount<\/mark>with the value (275.00) copied to the parameter <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">amount<\/mark>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\">CheckingAccount.WithdrawMoney(275.00)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">ShowButton: Pressed<\/h3>\n\n\n\n<p>The <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Pressed<\/mark> event of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">ShowButton<\/mark> must show the value of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">AccountBalance<\/mark>. The value will be returned by the method <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">GetBalance<\/mark>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-light-gray-background-color has-background\" style=\"line-height:1.4\">BalanceLabel.Text = \"The balance of the checking account = \" + _ \n   CheckingAccount.GetBalance.ToString(locale.current)<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted has-yellow-background-color has-background\">The underscore character (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">_<\/mark>) is used to indicate that the current line continues on the next line.<\/pre>\n\n\n\n<p>Because the Text property of <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">BalanceLabel<\/mark> only accepts <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">String<\/mark> values, the value returned by <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">GetBalance<\/mark> (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">Currency<\/mark>) must be converted to a <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">String<\/mark> (<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">ToString<\/mark>). The <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">ToString<\/mark> parameter <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">locale.current<\/mark> uses the settings of the system to display the number format and the currency sign.<\/p>\n\n\n\n<p>Your application is ready to run. Check your starting balance by pressing the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">ShowButton<\/mark>. Then add 1500.00 by pressing the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">DepositButton<\/mark> and decrease your balance with 275.00 by pressing the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-bright-red-color\">WithDrawButton<\/mark>. The balance of your account must be calculated correctly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In this lesson we will define the Account class as discussed in the previous lesson. Member data (properties) will be added to the class and member methods are developed and inserted into the class. How define a new Class? A new class can be inserted in a program by selecting Class from the Insert &hellip; <a href=\"https:\/\/xojo.itbib4you.be\/index.php\/the-account-class\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Account Class&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-258","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/pages\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":44,"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/pages\/258\/revisions"}],"predecessor-version":[{"id":341,"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/pages\/258\/revisions\/341"}],"wp:attachment":[{"href":"https:\/\/xojo.itbib4you.be\/index.php\/wp-json\/wp\/v2\/media?parent=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}